{
 "cells": [
  {
   "cell_type": "code",
   "execution_count": 25,
   "metadata": {},
   "outputs": [],
   "source": [
    "import pandas as pd\n",
    "import numpy as np\n",
    "from scipy import stats\n",
    "import plotly.express as px\n",
    "import mytools\n"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 26,
   "metadata": {},
   "outputs": [],
   "source": [
    "df1 = pd.read_excel(R\"data\\AI作品态度.xlsx\")"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "解释性研究是关于现象或事物之间因果关系的研究。解释性研究是在描述性研究的基础上，进一步探寻“为什么”。解释性研究要在描述性研究的基础上对变量之间的关系进行分析，以确定它们之间是否存在相关，并进而判断它们之间是否存在因果关系。\n",
    "\n",
    "在定量研究方法中，解释性研究通常是首先提出研究假设，然后从理论假设出发，设计出调查方案（收集资料的方案）并采用各种调查方法去收集经验材料，最后通过对资料的分析来验证假设，达到对社会现象进行理论解释的目的。"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## 明确数据分析目标\n",
    "\n",
    "本案例属于解释性研究。\n",
    "\n",
    "研究假设：批判性思维能力越强，对待ai作品的态度越积极。\n",
    "原假设：批判性思维能力与对待ai作品的态度无关。"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## 数据获取\n",
    "\n",
    "时间、渠道、数量、抽样方法"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## 数据清理"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 27,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>序号</th>\n",
       "      <th>提交答卷时间</th>\n",
       "      <th>所用时间</th>\n",
       "      <th>来源</th>\n",
       "      <th>来源详情</th>\n",
       "      <th>来自IP</th>\n",
       "      <th>1、Al作品与人类作品您认为是否有区别?</th>\n",
       "      <th>2、请问以下哪个图是AI绘图形成：</th>\n",
       "      <th>3、以下哪张图是传统绘画作品</th>\n",
       "      <th>4、你是否喜欢绘画？</th>\n",
       "      <th>...</th>\n",
       "      <th>15、你认为事实和立场，哪个更重要？</th>\n",
       "      <th>16、AI绘画提供了更多创意，促进了艺术领域的繁荣</th>\n",
       "      <th>17、市面上有各种各样的绘画材料，甚至价格不菲，而通过AI软件绘画则不需要购买这些材料。我认为，在未来AI的发展会打击绘画材料的市场</th>\n",
       "      <th>18、越来越多的公司要求设计作品用电脑软件来完成，在未来商业上，我认为AI作品会取代手绘作品</th>\n",
       "      <th>19、AI作画推广过程中，绘画创作行业产生激烈竞争，我会选择对这个行业避而远之</th>\n",
       "      <th>20、比起对于低成本，高效率的工作方法，我更倾向具有工匠精神的工作方法</th>\n",
       "      <th>21、在面对各种相互对立的想法时，我喜欢确定哪一种是做某件事情的正确方式和方法</th>\n",
       "      <th>22、对于新事物，我喜欢去尝试和体验</th>\n",
       "      <th>23、请问您是否觉得此问卷有不足的地方或建议</th>\n",
       "      <th>总分</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>0</th>\n",
       "      <td>1</td>\n",
       "      <td>2022/11/21 21:39:19</td>\n",
       "      <td>233秒</td>\n",
       "      <td>微信</td>\n",
       "      <td>NaN</td>\n",
       "      <td>117.191.176.254(新疆-伊犁)</td>\n",
       "      <td>有区别，人类作品能感受到创作情感。</td>\n",
       "      <td>图2</td>\n",
       "      <td>图1</td>\n",
       "      <td>从来不画画</td>\n",
       "      <td>...</td>\n",
       "      <td>不知道，这个要看具体事情吧</td>\n",
       "      <td>62</td>\n",
       "      <td>79</td>\n",
       "      <td>39</td>\n",
       "      <td>38</td>\n",
       "      <td>50</td>\n",
       "      <td>66</td>\n",
       "      <td>80</td>\n",
       "      <td>无</td>\n",
       "      <td>414</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1</th>\n",
       "      <td>2</td>\n",
       "      <td>2022/11/21 21:46:40</td>\n",
       "      <td>50秒</td>\n",
       "      <td>微信</td>\n",
       "      <td>NaN</td>\n",
       "      <td>14.134.101.116(宁夏-固原)</td>\n",
       "      <td>有区别，人类作品能感受到创作情感。</td>\n",
       "      <td>图2</td>\n",
       "      <td>图1</td>\n",
       "      <td>从来不画画</td>\n",
       "      <td>...</td>\n",
       "      <td>事实</td>\n",
       "      <td>35</td>\n",
       "      <td>54</td>\n",
       "      <td>21</td>\n",
       "      <td>58</td>\n",
       "      <td>46</td>\n",
       "      <td>94</td>\n",
       "      <td>36</td>\n",
       "      <td>(空)</td>\n",
       "      <td>344</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2</th>\n",
       "      <td>3</td>\n",
       "      <td>2022/11/21 21:47:12</td>\n",
       "      <td>45秒</td>\n",
       "      <td>微信</td>\n",
       "      <td>NaN</td>\n",
       "      <td>210.26.15.148(甘肃-兰州)</td>\n",
       "      <td>有区别，人类作品能感受到创作情感。</td>\n",
       "      <td>看不出来</td>\n",
       "      <td>图1</td>\n",
       "      <td>从来不画画</td>\n",
       "      <td>...</td>\n",
       "      <td>不知道，这个要看具体事情吧</td>\n",
       "      <td>22</td>\n",
       "      <td>40</td>\n",
       "      <td>65</td>\n",
       "      <td>5</td>\n",
       "      <td>39</td>\n",
       "      <td>86</td>\n",
       "      <td>39</td>\n",
       "      <td>无</td>\n",
       "      <td>296</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3</th>\n",
       "      <td>4</td>\n",
       "      <td>2022/11/21 21:47:34</td>\n",
       "      <td>90秒</td>\n",
       "      <td>微信</td>\n",
       "      <td>NaN</td>\n",
       "      <td>42.93.105.122(甘肃-定西)</td>\n",
       "      <td>有区别，人类作品能感受到创作情感。</td>\n",
       "      <td>看不出来</td>\n",
       "      <td>看不出来</td>\n",
       "      <td>从来不画画</td>\n",
       "      <td>...</td>\n",
       "      <td>事实</td>\n",
       "      <td>33</td>\n",
       "      <td>64</td>\n",
       "      <td>48</td>\n",
       "      <td>63</td>\n",
       "      <td>45</td>\n",
       "      <td>52</td>\n",
       "      <td>79</td>\n",
       "      <td>无</td>\n",
       "      <td>384</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>4</th>\n",
       "      <td>5</td>\n",
       "      <td>2022/11/21 21:48:47</td>\n",
       "      <td>49秒</td>\n",
       "      <td>微信</td>\n",
       "      <td>NaN</td>\n",
       "      <td>42.88.207.8(甘肃-武威)</td>\n",
       "      <td>有区别，人类作品能感受到创作情感。</td>\n",
       "      <td>都不是</td>\n",
       "      <td>都是</td>\n",
       "      <td>从来不画画</td>\n",
       "      <td>...</td>\n",
       "      <td>事实大于立场</td>\n",
       "      <td>83</td>\n",
       "      <td>50</td>\n",
       "      <td>50</td>\n",
       "      <td>41</td>\n",
       "      <td>28</td>\n",
       "      <td>68</td>\n",
       "      <td>66</td>\n",
       "      <td>(空)</td>\n",
       "      <td>386</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>...</th>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>118</th>\n",
       "      <td>119</td>\n",
       "      <td>2022/11/24 21:58:36</td>\n",
       "      <td>259秒</td>\n",
       "      <td>微信</td>\n",
       "      <td>NaN</td>\n",
       "      <td>61.178.223.212(甘肃-兰州)</td>\n",
       "      <td>有区别，人类作品能感受到创作情感。</td>\n",
       "      <td>都不是</td>\n",
       "      <td>图2</td>\n",
       "      <td>平时都不会画，除非有工作或学习上的要求</td>\n",
       "      <td>...</td>\n",
       "      <td>事实和立场各占一半</td>\n",
       "      <td>57</td>\n",
       "      <td>14</td>\n",
       "      <td>13</td>\n",
       "      <td>52</td>\n",
       "      <td>89</td>\n",
       "      <td>65</td>\n",
       "      <td>89</td>\n",
       "      <td>无</td>\n",
       "      <td>379</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>119</th>\n",
       "      <td>120</td>\n",
       "      <td>2022/11/25 12:43:34</td>\n",
       "      <td>180秒</td>\n",
       "      <td>微信</td>\n",
       "      <td>NaN</td>\n",
       "      <td>39.161.242.37(江西-南昌)</td>\n",
       "      <td>有区别，人类作品能感受到创作情感。</td>\n",
       "      <td>图1</td>\n",
       "      <td>图2</td>\n",
       "      <td>还行，偶尔画画</td>\n",
       "      <td>...</td>\n",
       "      <td>事实和立场各占一半</td>\n",
       "      <td>43</td>\n",
       "      <td>81</td>\n",
       "      <td>24</td>\n",
       "      <td>62</td>\n",
       "      <td>62</td>\n",
       "      <td>64</td>\n",
       "      <td>53</td>\n",
       "      <td>(空)</td>\n",
       "      <td>389</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>141</th>\n",
       "      <td>142</td>\n",
       "      <td>2022/11/25 20:19:40</td>\n",
       "      <td>179秒</td>\n",
       "      <td>微信</td>\n",
       "      <td>NaN</td>\n",
       "      <td>110.185.95.191(四川-成都)</td>\n",
       "      <td>有区别，人类作品能感受到创作情感。</td>\n",
       "      <td>看不出来</td>\n",
       "      <td>看不出来</td>\n",
       "      <td>从来不画画</td>\n",
       "      <td>...</td>\n",
       "      <td>不知道，这个要看具体事情吧</td>\n",
       "      <td>34</td>\n",
       "      <td>100</td>\n",
       "      <td>77</td>\n",
       "      <td>100</td>\n",
       "      <td>77</td>\n",
       "      <td>56</td>\n",
       "      <td>54</td>\n",
       "      <td>(空)</td>\n",
       "      <td>498</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>144</th>\n",
       "      <td>145</td>\n",
       "      <td>2022/11/25 20:38:00</td>\n",
       "      <td>310秒</td>\n",
       "      <td>微信</td>\n",
       "      <td>NaN</td>\n",
       "      <td>112.4.255.167(江苏-镇江)</td>\n",
       "      <td>有区别，人类作品能感受到创作情感。</td>\n",
       "      <td>图1</td>\n",
       "      <td>都是</td>\n",
       "      <td>还行，偶尔画画</td>\n",
       "      <td>...</td>\n",
       "      <td>不知道，这个要看具体事情吧</td>\n",
       "      <td>20</td>\n",
       "      <td>82</td>\n",
       "      <td>39</td>\n",
       "      <td>22</td>\n",
       "      <td>51</td>\n",
       "      <td>49</td>\n",
       "      <td>82</td>\n",
       "      <td>(空)</td>\n",
       "      <td>345</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>149</th>\n",
       "      <td>150</td>\n",
       "      <td>2022/11/28 22:03:35</td>\n",
       "      <td>111秒</td>\n",
       "      <td>微信</td>\n",
       "      <td>NaN</td>\n",
       "      <td>36.142.173.157(甘肃-临夏)</td>\n",
       "      <td>有区别，人类作品能感受到创作情感。</td>\n",
       "      <td>图2</td>\n",
       "      <td>图1</td>\n",
       "      <td>还行，偶尔画画</td>\n",
       "      <td>...</td>\n",
       "      <td>事实大于立场</td>\n",
       "      <td>57</td>\n",
       "      <td>48</td>\n",
       "      <td>74</td>\n",
       "      <td>46</td>\n",
       "      <td>52</td>\n",
       "      <td>52</td>\n",
       "      <td>80</td>\n",
       "      <td>(空)</td>\n",
       "      <td>409</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "<p>103 rows × 30 columns</p>\n",
       "</div>"
      ],
      "text/plain": [
       "      序号               提交答卷时间  所用时间  来源 来源详情                    来自IP  \\\n",
       "0      1  2022/11/21 21:39:19  233秒  微信  NaN  117.191.176.254(新疆-伊犁)   \n",
       "1      2  2022/11/21 21:46:40   50秒  微信  NaN   14.134.101.116(宁夏-固原)   \n",
       "2      3  2022/11/21 21:47:12   45秒  微信  NaN    210.26.15.148(甘肃-兰州)   \n",
       "3      4  2022/11/21 21:47:34   90秒  微信  NaN    42.93.105.122(甘肃-定西)   \n",
       "4      5  2022/11/21 21:48:47   49秒  微信  NaN      42.88.207.8(甘肃-武威)   \n",
       "..   ...                  ...   ...  ..  ...                     ...   \n",
       "118  119  2022/11/24 21:58:36  259秒  微信  NaN   61.178.223.212(甘肃-兰州)   \n",
       "119  120  2022/11/25 12:43:34  180秒  微信  NaN    39.161.242.37(江西-南昌)   \n",
       "141  142  2022/11/25 20:19:40  179秒  微信  NaN   110.185.95.191(四川-成都)   \n",
       "144  145  2022/11/25 20:38:00  310秒  微信  NaN    112.4.255.167(江苏-镇江)   \n",
       "149  150  2022/11/28 22:03:35  111秒  微信  NaN   36.142.173.157(甘肃-临夏)   \n",
       "\n",
       "    1、Al作品与人类作品您认为是否有区别? 2、请问以下哪个图是AI绘图形成： 3、以下哪张图是传统绘画作品  \\\n",
       "0      有区别，人类作品能感受到创作情感。                图2             图1   \n",
       "1      有区别，人类作品能感受到创作情感。                图2             图1   \n",
       "2      有区别，人类作品能感受到创作情感。              看不出来             图1   \n",
       "3      有区别，人类作品能感受到创作情感。              看不出来           看不出来   \n",
       "4      有区别，人类作品能感受到创作情感。               都不是             都是   \n",
       "..                   ...               ...            ...   \n",
       "118    有区别，人类作品能感受到创作情感。               都不是             图2   \n",
       "119    有区别，人类作品能感受到创作情感。                图1             图2   \n",
       "141    有区别，人类作品能感受到创作情感。              看不出来           看不出来   \n",
       "144    有区别，人类作品能感受到创作情感。                图1             都是   \n",
       "149    有区别，人类作品能感受到创作情感。                图2             图1   \n",
       "\n",
       "              4、你是否喜欢绘画？  ... 15、你认为事实和立场，哪个更重要？ 16、AI绘画提供了更多创意，促进了艺术领域的繁荣  \\\n",
       "0                  从来不画画  ...      不知道，这个要看具体事情吧                        62   \n",
       "1                  从来不画画  ...                 事实                        35   \n",
       "2                  从来不画画  ...      不知道，这个要看具体事情吧                        22   \n",
       "3                  从来不画画  ...                 事实                        33   \n",
       "4                  从来不画画  ...             事实大于立场                        83   \n",
       "..                   ...  ...                ...                       ...   \n",
       "118  平时都不会画，除非有工作或学习上的要求  ...          事实和立场各占一半                        57   \n",
       "119              还行，偶尔画画  ...          事实和立场各占一半                        43   \n",
       "141                从来不画画  ...      不知道，这个要看具体事情吧                        34   \n",
       "144              还行，偶尔画画  ...      不知道，这个要看具体事情吧                        20   \n",
       "149              还行，偶尔画画  ...             事实大于立场                        57   \n",
       "\n",
       "    17、市面上有各种各样的绘画材料，甚至价格不菲，而通过AI软件绘画则不需要购买这些材料。我认为，在未来AI的发展会打击绘画材料的市场  \\\n",
       "0                                                   79                   \n",
       "1                                                   54                   \n",
       "2                                                   40                   \n",
       "3                                                   64                   \n",
       "4                                                   50                   \n",
       "..                                                 ...                   \n",
       "118                                                 14                   \n",
       "119                                                 81                   \n",
       "141                                                100                   \n",
       "144                                                 82                   \n",
       "149                                                 48                   \n",
       "\n",
       "    18、越来越多的公司要求设计作品用电脑软件来完成，在未来商业上，我认为AI作品会取代手绘作品  \\\n",
       "0                                               39   \n",
       "1                                               21   \n",
       "2                                               65   \n",
       "3                                               48   \n",
       "4                                               50   \n",
       "..                                             ...   \n",
       "118                                             13   \n",
       "119                                             24   \n",
       "141                                             77   \n",
       "144                                             39   \n",
       "149                                             74   \n",
       "\n",
       "    19、AI作画推广过程中，绘画创作行业产生激烈竞争，我会选择对这个行业避而远之  \\\n",
       "0                                        38   \n",
       "1                                        58   \n",
       "2                                         5   \n",
       "3                                        63   \n",
       "4                                        41   \n",
       "..                                      ...   \n",
       "118                                      52   \n",
       "119                                      62   \n",
       "141                                     100   \n",
       "144                                      22   \n",
       "149                                      46   \n",
       "\n",
       "    20、比起对于低成本，高效率的工作方法，我更倾向具有工匠精神的工作方法  \\\n",
       "0                                    50   \n",
       "1                                    46   \n",
       "2                                    39   \n",
       "3                                    45   \n",
       "4                                    28   \n",
       "..                                  ...   \n",
       "118                                  89   \n",
       "119                                  62   \n",
       "141                                  77   \n",
       "144                                  51   \n",
       "149                                  52   \n",
       "\n",
       "    21、在面对各种相互对立的想法时，我喜欢确定哪一种是做某件事情的正确方式和方法 22、对于新事物，我喜欢去尝试和体验  \\\n",
       "0                                        66                 80   \n",
       "1                                        94                 36   \n",
       "2                                        86                 39   \n",
       "3                                        52                 79   \n",
       "4                                        68                 66   \n",
       "..                                      ...                ...   \n",
       "118                                      65                 89   \n",
       "119                                      64                 53   \n",
       "141                                      56                 54   \n",
       "144                                      49                 82   \n",
       "149                                      52                 80   \n",
       "\n",
       "    23、请问您是否觉得此问卷有不足的地方或建议   总分  \n",
       "0                        无  414  \n",
       "1                      (空)  344  \n",
       "2                        无  296  \n",
       "3                        无  384  \n",
       "4                      (空)  386  \n",
       "..                     ...  ...  \n",
       "118                      无  379  \n",
       "119                    (空)  389  \n",
       "141                    (空)  498  \n",
       "144                    (空)  345  \n",
       "149                    (空)  409  \n",
       "\n",
       "[103 rows x 30 columns]"
      ]
     },
     "execution_count": 27,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "### 空白值处理\n",
    "temp = df1[df1.isnull().T.any()]\n",
    "temp"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 28,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>序号</th>\n",
       "      <th>提交答卷时间</th>\n",
       "      <th>所用时间</th>\n",
       "      <th>来源</th>\n",
       "      <th>来自IP</th>\n",
       "      <th>1、Al作品与人类作品您认为是否有区别?</th>\n",
       "      <th>2、请问以下哪个图是AI绘图形成：</th>\n",
       "      <th>3、以下哪张图是传统绘画作品</th>\n",
       "      <th>4、你是否喜欢绘画？</th>\n",
       "      <th>5、你是否了解AI(创作）？</th>\n",
       "      <th>...</th>\n",
       "      <th>15、你认为事实和立场，哪个更重要？</th>\n",
       "      <th>16、AI绘画提供了更多创意，促进了艺术领域的繁荣</th>\n",
       "      <th>17、市面上有各种各样的绘画材料，甚至价格不菲，而通过AI软件绘画则不需要购买这些材料。我认为，在未来AI的发展会打击绘画材料的市场</th>\n",
       "      <th>18、越来越多的公司要求设计作品用电脑软件来完成，在未来商业上，我认为AI作品会取代手绘作品</th>\n",
       "      <th>19、AI作画推广过程中，绘画创作行业产生激烈竞争，我会选择对这个行业避而远之</th>\n",
       "      <th>20、比起对于低成本，高效率的工作方法，我更倾向具有工匠精神的工作方法</th>\n",
       "      <th>21、在面对各种相互对立的想法时，我喜欢确定哪一种是做某件事情的正确方式和方法</th>\n",
       "      <th>22、对于新事物，我喜欢去尝试和体验</th>\n",
       "      <th>23、请问您是否觉得此问卷有不足的地方或建议</th>\n",
       "      <th>总分</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "  </tbody>\n",
       "</table>\n",
       "<p>0 rows × 29 columns</p>\n",
       "</div>"
      ],
      "text/plain": [
       "Empty DataFrame\n",
       "Columns: [序号, 提交答卷时间, 所用时间, 来源, 来自IP, 1、Al作品与人类作品您认为是否有区别?, 2、请问以下哪个图是AI绘图形成：, 3、以下哪张图是传统绘画作品, 4、你是否喜欢绘画？, 5、你是否了解AI(创作）？, 6、如果你会使用AI绘图，你是否想要将其应用到你的生活和工作之中？, 7、假如你是AI绘画研发人员，在AI绘画推广过程中，你更看重？(多选), 8、请问你认为借助AI创作出的作品可以被称为艺术品吗?, 9、当您作为观看者时，请问您更喜欢观赏传统及现有绘画艺术作品还是AI(绘画)艺术作品?, 10、在今年美国科罗拉多轴博览会艺术比赛中的数字类别中，39岁游戏设计师JasonAllen的作品夺得头奖。这副画作是他使用AI绘图工具完成的，这引来了不少来自人类艺术家的指责。如果是你，你会支持JasonAllen吗?, 11、“Al的产生到底是为了方便人的生产激发人的创造力，还是要践踏无数艺术家的创造力扶摇直上。”这句话你怎么看?, 12、你认为AI的发展会对绘画行业造成多大影响, 13、面对某一件事情，你更在乎过程还是结果？, 14、对某一件事情的看法，你认为你更多的是出于理性还是感性？, 15、你认为事实和立场，哪个更重要？, 16、AI绘画提供了更多创意，促进了艺术领域的繁荣, 17、市面上有各种各样的绘画材料，甚至价格不菲，而通过AI软件绘画则不需要购买这些材料。我认为，在未来AI的发展会打击绘画材料的市场, 18、越来越多的公司要求设计作品用电脑软件来完成，在未来商业上，我认为AI作品会取代手绘作品, 19、AI作画推广过程中，绘画创作行业产生激烈竞争，我会选择对这个行业避而远之, 20、比起对于低成本，高效率的工作方法，我更倾向具有工匠精神的工作方法, 21、在面对各种相互对立的想法时，我喜欢确定哪一种是做某件事情的正确方式和方法, 22、对于新事物，我喜欢去尝试和体验, 23、请问您是否觉得此问卷有不足的地方或建议, 总分]\n",
       "Index: []\n",
       "\n",
       "[0 rows x 29 columns]"
      ]
     },
     "execution_count": 28,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "### 删除空值列——来源详情\n",
    "df2 = df1.drop(columns=\"来源详情\")\n",
    "\"\"\"再次查看空白列\"\"\"\n",
    "temp = df2[df2.isnull().T.any()]\n",
    "temp\n"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 5,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>来自IP</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>55</th>\n",
       "      <td>61.178.223.214(甘肃-兰州)</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>62</th>\n",
       "      <td>112.49.214.250(福建-福州)</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>95</th>\n",
       "      <td>61.178.223.214(甘肃-兰州)</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "</div>"
      ],
      "text/plain": [
       "                     来自IP\n",
       "55  61.178.223.214(甘肃-兰州)\n",
       "62  112.49.214.250(福建-福州)\n",
       "95  61.178.223.214(甘肃-兰州)"
      ]
     },
     "execution_count": 5,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "## 查看重复值\n",
    "df2[df2.duplicated(subset=['来自IP'],keep='first')][['来自IP']]"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 6,
   "metadata": {},
   "outputs": [],
   "source": [
    "# 删除重复值\n",
    "df3 = df2.drop_duplicates(subset=['来自IP'],keep='first')"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 30,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>0</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>序号</th>\n",
       "      <td>int64</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>提交答卷时间</th>\n",
       "      <td>object</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>所用时间</th>\n",
       "      <td>object</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>来源</th>\n",
       "      <td>object</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>来自IP</th>\n",
       "      <td>object</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1、Al作品与人类作品您认为是否有区别?</th>\n",
       "      <td>object</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2、请问以下哪个图是AI绘图形成：</th>\n",
       "      <td>object</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3、以下哪张图是传统绘画作品</th>\n",
       "      <td>object</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>4、你是否喜欢绘画？</th>\n",
       "      <td>object</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>5、你是否了解AI(创作）？</th>\n",
       "      <td>object</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>6、如果你会使用AI绘图，你是否想要将其应用到你的生活和工作之中？</th>\n",
       "      <td>object</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>7、假如你是AI绘画研发人员，在AI绘画推广过程中，你更看重？(多选)</th>\n",
       "      <td>object</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>8、请问你认为借助AI创作出的作品可以被称为艺术品吗?</th>\n",
       "      <td>object</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>9、当您作为观看者时，请问您更喜欢观赏传统及现有绘画艺术作品还是AI(绘画)艺术作品?</th>\n",
       "      <td>object</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>10、在今年美国科罗拉多轴博览会艺术比赛中的数字类别中，39岁游戏设计师JasonAllen的作品夺得头奖。这副画作是他使用AI绘图工具完成的，这引来了不少来自人类艺术家的指责。如果是你，你会支持JasonAllen吗?</th>\n",
       "      <td>object</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>11、“Al的产生到底是为了方便人的生产激发人的创造力，还是要践踏无数艺术家的创造力扶摇直上。”这句话你怎么看?</th>\n",
       "      <td>object</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>12、你认为AI的发展会对绘画行业造成多大影响</th>\n",
       "      <td>object</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>13、面对某一件事情，你更在乎过程还是结果？</th>\n",
       "      <td>object</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>14、对某一件事情的看法，你认为你更多的是出于理性还是感性？</th>\n",
       "      <td>object</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>15、你认为事实和立场，哪个更重要？</th>\n",
       "      <td>object</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>16、AI绘画提供了更多创意，促进了艺术领域的繁荣</th>\n",
       "      <td>int64</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>17、市面上有各种各样的绘画材料，甚至价格不菲，而通过AI软件绘画则不需要购买这些材料。我认为，在未来AI的发展会打击绘画材料的市场</th>\n",
       "      <td>int64</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>18、越来越多的公司要求设计作品用电脑软件来完成，在未来商业上，我认为AI作品会取代手绘作品</th>\n",
       "      <td>int64</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>19、AI作画推广过程中，绘画创作行业产生激烈竞争，我会选择对这个行业避而远之</th>\n",
       "      <td>int64</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>20、比起对于低成本，高效率的工作方法，我更倾向具有工匠精神的工作方法</th>\n",
       "      <td>int64</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>21、在面对各种相互对立的想法时，我喜欢确定哪一种是做某件事情的正确方式和方法</th>\n",
       "      <td>int64</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>22、对于新事物，我喜欢去尝试和体验</th>\n",
       "      <td>int64</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>23、请问您是否觉得此问卷有不足的地方或建议</th>\n",
       "      <td>object</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>总分</th>\n",
       "      <td>int64</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>填写问卷时长</th>\n",
       "      <td>object</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "</div>"
      ],
      "text/plain": [
       "                                                         0\n",
       "序号                                                   int64\n",
       "提交答卷时间                                              object\n",
       "所用时间                                                object\n",
       "来源                                                  object\n",
       "来自IP                                                object\n",
       "1、Al作品与人类作品您认为是否有区别?                                object\n",
       "2、请问以下哪个图是AI绘图形成：                                   object\n",
       "3、以下哪张图是传统绘画作品                                      object\n",
       "4、你是否喜欢绘画？                                          object\n",
       "5、你是否了解AI(创作）？                                      object\n",
       "6、如果你会使用AI绘图，你是否想要将其应用到你的生活和工作之中？                   object\n",
       "7、假如你是AI绘画研发人员，在AI绘画推广过程中，你更看重？(多选)                 object\n",
       "8、请问你认为借助AI创作出的作品可以被称为艺术品吗?                         object\n",
       "9、当您作为观看者时，请问您更喜欢观赏传统及现有绘画艺术作品还是AI(绘画)艺术作品?         object\n",
       "10、在今年美国科罗拉多轴博览会艺术比赛中的数字类别中，39岁游戏设计师JasonAllen的...  object\n",
       "11、“Al的产生到底是为了方便人的生产激发人的创造力，还是要践踏无数艺术家的创造力扶摇直上。...  object\n",
       "12、你认为AI的发展会对绘画行业造成多大影响                             object\n",
       "13、面对某一件事情，你更在乎过程还是结果？                              object\n",
       "14、对某一件事情的看法，你认为你更多的是出于理性还是感性？                      object\n",
       "15、你认为事实和立场，哪个更重要？                                  object\n",
       "16、AI绘画提供了更多创意，促进了艺术领域的繁荣                            int64\n",
       "17、市面上有各种各样的绘画材料，甚至价格不菲，而通过AI软件绘画则不需要购买这些材料。我认为...   int64\n",
       "18、越来越多的公司要求设计作品用电脑软件来完成，在未来商业上，我认为AI作品会取代手绘作品       int64\n",
       "19、AI作画推广过程中，绘画创作行业产生激烈竞争，我会选择对这个行业避而远之              int64\n",
       "20、比起对于低成本，高效率的工作方法，我更倾向具有工匠精神的工作方法                  int64\n",
       "21、在面对各种相互对立的想法时，我喜欢确定哪一种是做某件事情的正确方式和方法              int64\n",
       "22、对于新事物，我喜欢去尝试和体验                                   int64\n",
       "23、请问您是否觉得此问卷有不足的地方或建议                              object\n",
       "总分                                                   int64\n",
       "填写问卷时长                                              object"
      ]
     },
     "execution_count": 30,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "# 查看变量类型\n",
    "df3.dtypes.to_frame()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 31,
   "metadata": {},
   "outputs": [],
   "source": [
    "### 必要的数据转换\n",
    "df3['填写问卷时长'] = df3['所用时间'].str.rstrip('秒')"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 9,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>0</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>序号</th>\n",
       "      <td>int64</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>提交答卷时间</th>\n",
       "      <td>datetime64[ns]</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>所用时间</th>\n",
       "      <td>string</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>来源</th>\n",
       "      <td>string</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>来自IP</th>\n",
       "      <td>string</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1、Al作品与人类作品您认为是否有区别?</th>\n",
       "      <td>category</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2、请问以下哪个图是AI绘图形成：</th>\n",
       "      <td>category</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3、以下哪张图是传统绘画作品</th>\n",
       "      <td>category</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>4、你是否喜欢绘画？</th>\n",
       "      <td>category</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>5、你是否了解AI(创作）？</th>\n",
       "      <td>category</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>6、如果你会使用AI绘图，你是否想要将其应用到你的生活和工作之中？</th>\n",
       "      <td>category</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>7、假如你是AI绘画研发人员，在AI绘画推广过程中，你更看重？(多选)</th>\n",
       "      <td>string</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>8、请问你认为借助AI创作出的作品可以被称为艺术品吗?</th>\n",
       "      <td>category</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>9、当您作为观看者时，请问您更喜欢观赏传统及现有绘画艺术作品还是AI(绘画)艺术作品?</th>\n",
       "      <td>category</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>10、在今年美国科罗拉多轴博览会艺术比赛中的数字类别中，39岁游戏设计师JasonAllen的作品夺得头奖。这副画作是他使用AI绘图工具完成的，这引来了不少来自人类艺术家的指责。如果是你，你会支持JasonAllen吗?</th>\n",
       "      <td>category</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>11、“Al的产生到底是为了方便人的生产激发人的创造力，还是要践踏无数艺术家的创造力扶摇直上。”这句话你怎么看?</th>\n",
       "      <td>category</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>12、你认为AI的发展会对绘画行业造成多大影响</th>\n",
       "      <td>category</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>13、面对某一件事情，你更在乎过程还是结果？</th>\n",
       "      <td>category</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>14、对某一件事情的看法，你认为你更多的是出于理性还是感性？</th>\n",
       "      <td>category</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>15、你认为事实和立场，哪个更重要？</th>\n",
       "      <td>category</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>16、AI绘画提供了更多创意，促进了艺术领域的繁荣</th>\n",
       "      <td>int64</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>17、市面上有各种各样的绘画材料，甚至价格不菲，而通过AI软件绘画则不需要购买这些材料。我认为，在未来AI的发展会打击绘画材料的市场</th>\n",
       "      <td>int64</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>18、越来越多的公司要求设计作品用电脑软件来完成，在未来商业上，我认为AI作品会取代手绘作品</th>\n",
       "      <td>int64</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>19、AI作画推广过程中，绘画创作行业产生激烈竞争，我会选择对这个行业避而远之</th>\n",
       "      <td>int64</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>20、比起对于低成本，高效率的工作方法，我更倾向具有工匠精神的工作方法</th>\n",
       "      <td>int64</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>21、在面对各种相互对立的想法时，我喜欢确定哪一种是做某件事情的正确方式和方法</th>\n",
       "      <td>int64</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>22、对于新事物，我喜欢去尝试和体验</th>\n",
       "      <td>int64</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>23、请问您是否觉得此问卷有不足的地方或建议</th>\n",
       "      <td>object</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>总分</th>\n",
       "      <td>int64</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>填写问卷时长</th>\n",
       "      <td>int32</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "</div>"
      ],
      "text/plain": [
       "                                                                 0\n",
       "序号                                                           int64\n",
       "提交答卷时间                                              datetime64[ns]\n",
       "所用时间                                                        string\n",
       "来源                                                          string\n",
       "来自IP                                                        string\n",
       "1、Al作品与人类作品您认为是否有区别?                                      category\n",
       "2、请问以下哪个图是AI绘图形成：                                         category\n",
       "3、以下哪张图是传统绘画作品                                            category\n",
       "4、你是否喜欢绘画？                                                category\n",
       "5、你是否了解AI(创作）？                                            category\n",
       "6、如果你会使用AI绘图，你是否想要将其应用到你的生活和工作之中？                         category\n",
       "7、假如你是AI绘画研发人员，在AI绘画推广过程中，你更看重？(多选)                         string\n",
       "8、请问你认为借助AI创作出的作品可以被称为艺术品吗?                               category\n",
       "9、当您作为观看者时，请问您更喜欢观赏传统及现有绘画艺术作品还是AI(绘画)艺术作品?               category\n",
       "10、在今年美国科罗拉多轴博览会艺术比赛中的数字类别中，39岁游戏设计师JasonAllen的...        category\n",
       "11、“Al的产生到底是为了方便人的生产激发人的创造力，还是要践踏无数艺术家的创造力扶摇直上。...        category\n",
       "12、你认为AI的发展会对绘画行业造成多大影响                                   category\n",
       "13、面对某一件事情，你更在乎过程还是结果？                                    category\n",
       "14、对某一件事情的看法，你认为你更多的是出于理性还是感性？                            category\n",
       "15、你认为事实和立场，哪个更重要？                                        category\n",
       "16、AI绘画提供了更多创意，促进了艺术领域的繁荣                                    int64\n",
       "17、市面上有各种各样的绘画材料，甚至价格不菲，而通过AI软件绘画则不需要购买这些材料。我认为...           int64\n",
       "18、越来越多的公司要求设计作品用电脑软件来完成，在未来商业上，我认为AI作品会取代手绘作品               int64\n",
       "19、AI作画推广过程中，绘画创作行业产生激烈竞争，我会选择对这个行业避而远之                      int64\n",
       "20、比起对于低成本，高效率的工作方法，我更倾向具有工匠精神的工作方法                          int64\n",
       "21、在面对各种相互对立的想法时，我喜欢确定哪一种是做某件事情的正确方式和方法                      int64\n",
       "22、对于新事物，我喜欢去尝试和体验                                           int64\n",
       "23、请问您是否觉得此问卷有不足的地方或建议                                      object\n",
       "总分                                                           int64\n",
       "填写问卷时长                                                       int32"
      ]
     },
     "execution_count": 9,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "# 指定变量的类型\n",
    "df4 = df3.astype({\n",
    "    '提交答卷时间': 'datetime64[ns]',\n",
    "    '所用时间': 'string',\n",
    "    '填写问卷时长': 'int',\n",
    "    '来源': 'string',\n",
    "    '来自IP': 'string',\n",
    "    '1、Al作品与人类作品您认为是否有区别?': 'category',\n",
    "    '2、请问以下哪个图是AI绘图形成：': 'category',\n",
    "    '3、以下哪张图是传统绘画作品': 'category',\n",
    "    '4、你是否喜欢绘画？': 'category',\n",
    "    '5、你是否了解AI(创作）？': 'category',\n",
    "    '6、如果你会使用AI绘图，你是否想要将其应用到你的生活和工作之中？': 'category',\n",
    "    '7、假如你是AI绘画研发人员，在AI绘画推广过程中，你更看重？(多选)': 'string',\n",
    "    '8、请问你认为借助AI创作出的作品可以被称为艺术品吗?': 'category',\n",
    "    '9、当您作为观看者时，请问您更喜欢观赏传统及现有绘画艺术作品还是AI(绘画)艺术作品?': 'category',\n",
    "    '10、在今年美国科罗拉多轴博览会艺术比赛中的数字类别中，39岁游戏设计师JasonAllen的作品夺得头奖。这副画作是他使用AI绘图工具完成的，这引来了不少来自人类艺术家的指责。如果是你，你会支持JasonAllen吗?': 'category',\n",
    "    '11、“Al的产生到底是为了方便人的生产激发人的创造力，还是要践踏无数艺术家的创造力扶摇直上。”这句话你怎么看?': 'category',\n",
    "    '12、你认为AI的发展会对绘画行业造成多大影响': 'category',\n",
    "    '13、面对某一件事情，你更在乎过程还是结果？': 'category',\n",
    "    '14、对某一件事情的看法，你认为你更多的是出于理性还是感性？': 'category',\n",
    "    '15、你认为事实和立场，哪个更重要？': 'category',\n",
    "})\n",
    "df4.dtypes.to_frame()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 32,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "count    147.000000\n",
       "mean     187.632653\n",
       "std      117.642253\n",
       "min       31.000000\n",
       "25%      111.500000\n",
       "50%      176.000000\n",
       "75%      227.000000\n",
       "max      937.000000\n",
       "Name: 填写问卷时长, dtype: float64"
      ]
     },
     "execution_count": 32,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "## 异常值查找\n",
    "df4['填写问卷时长'].describe()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 11,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "application/vnd.plotly.v1+json": {
       "config": {
        "plotlyServerURL": "https://plot.ly"
       },
       "data": [
        {
         "alignmentgroup": "True",
         "bingroup": "x",
         "hovertemplate": "填写问卷时长=%{x}<br>count=%{y}<extra></extra>",
         "legendgroup": "",
         "marker": {
          "color": "#636efa",
          "pattern": {
           "shape": ""
          }
         },
         "name": "",
         "offsetgroup": "",
         "orientation": "v",
         "showlegend": false,
         "type": "histogram",
         "x": [
          233,
          50,
          45,
          90,
          49,
          186,
          96,
          91,
          73,
          97,
          243,
          36,
          195,
          158,
          219,
          118,
          46,
          131,
          37,
          156,
          217,
          155,
          180,
          412,
          97,
          236,
          180,
          136,
          143,
          107,
          111,
          54,
          89,
          132,
          77,
          184,
          196,
          190,
          249,
          151,
          96,
          102,
          84,
          151,
          297,
          290,
          126,
          221,
          283,
          169,
          304,
          72,
          177,
          67,
          442,
          169,
          61,
          317,
          248,
          31,
          154,
          177,
          257,
          232,
          93,
          139,
          203,
          116,
          68,
          144,
          122,
          227,
          203,
          178,
          243,
          217,
          128,
          94,
          465,
          61,
          84,
          70,
          46,
          271,
          154,
          125,
          154,
          176,
          227,
          145,
          174,
          182,
          646,
          137,
          367,
          66,
          221,
          191,
          144,
          78,
          167,
          213,
          216,
          221,
          199,
          194,
          253,
          219,
          37,
          98,
          459,
          202,
          194,
          173,
          309,
          259,
          180,
          162,
          184,
          67,
          176,
          175,
          196,
          140,
          242,
          213,
          185,
          191,
          150,
          112,
          255,
          356,
          289,
          274,
          416,
          467,
          148,
          173,
          179,
          191,
          350,
          310,
          937,
          329,
          230,
          250,
          111
         ],
         "xaxis": "x",
         "yaxis": "y"
        }
       ],
       "layout": {
        "barmode": "relative",
        "legend": {
         "tracegroupgap": 0
        },
        "margin": {
         "t": 60
        },
        "template": {
         "data": {
          "bar": [
           {
            "error_x": {
             "color": "#2a3f5f"
            },
            "error_y": {
             "color": "#2a3f5f"
            },
            "marker": {
             "line": {
              "color": "#E5ECF6",
              "width": 0.5
             },
             "pattern": {
              "fillmode": "overlay",
              "size": 10,
              "solidity": 0.2
             }
            },
            "type": "bar"
           }
          ],
          "barpolar": [
           {
            "marker": {
             "line": {
              "color": "#E5ECF6",
              "width": 0.5
             },
             "pattern": {
              "fillmode": "overlay",
              "size": 10,
              "solidity": 0.2
             }
            },
            "type": "barpolar"
           }
          ],
          "carpet": [
           {
            "aaxis": {
             "endlinecolor": "#2a3f5f",
             "gridcolor": "white",
             "linecolor": "white",
             "minorgridcolor": "white",
             "startlinecolor": "#2a3f5f"
            },
            "baxis": {
             "endlinecolor": "#2a3f5f",
             "gridcolor": "white",
             "linecolor": "white",
             "minorgridcolor": "white",
             "startlinecolor": "#2a3f5f"
            },
            "type": "carpet"
           }
          ],
          "choropleth": [
           {
            "colorbar": {
             "outlinewidth": 0,
             "ticks": ""
            },
            "type": "choropleth"
           }
          ],
          "contour": [
           {
            "colorbar": {
             "outlinewidth": 0,
             "ticks": ""
            },
            "colorscale": [
             [
              0,
              "#0d0887"
             ],
             [
              0.1111111111111111,
              "#46039f"
             ],
             [
              0.2222222222222222,
              "#7201a8"
             ],
             [
              0.3333333333333333,
              "#9c179e"
             ],
             [
              0.4444444444444444,
              "#bd3786"
             ],
             [
              0.5555555555555556,
              "#d8576b"
             ],
             [
              0.6666666666666666,
              "#ed7953"
             ],
             [
              0.7777777777777778,
              "#fb9f3a"
             ],
             [
              0.8888888888888888,
              "#fdca26"
             ],
             [
              1,
              "#f0f921"
             ]
            ],
            "type": "contour"
           }
          ],
          "contourcarpet": [
           {
            "colorbar": {
             "outlinewidth": 0,
             "ticks": ""
            },
            "type": "contourcarpet"
           }
          ],
          "heatmap": [
           {
            "colorbar": {
             "outlinewidth": 0,
             "ticks": ""
            },
            "colorscale": [
             [
              0,
              "#0d0887"
             ],
             [
              0.1111111111111111,
              "#46039f"
             ],
             [
              0.2222222222222222,
              "#7201a8"
             ],
             [
              0.3333333333333333,
              "#9c179e"
             ],
             [
              0.4444444444444444,
              "#bd3786"
             ],
             [
              0.5555555555555556,
              "#d8576b"
             ],
             [
              0.6666666666666666,
              "#ed7953"
             ],
             [
              0.7777777777777778,
              "#fb9f3a"
             ],
             [
              0.8888888888888888,
              "#fdca26"
             ],
             [
              1,
              "#f0f921"
             ]
            ],
            "type": "heatmap"
           }
          ],
          "heatmapgl": [
           {
            "colorbar": {
             "outlinewidth": 0,
             "ticks": ""
            },
            "colorscale": [
             [
              0,
              "#0d0887"
             ],
             [
              0.1111111111111111,
              "#46039f"
             ],
             [
              0.2222222222222222,
              "#7201a8"
             ],
             [
              0.3333333333333333,
              "#9c179e"
             ],
             [
              0.4444444444444444,
              "#bd3786"
             ],
             [
              0.5555555555555556,
              "#d8576b"
             ],
             [
              0.6666666666666666,
              "#ed7953"
             ],
             [
              0.7777777777777778,
              "#fb9f3a"
             ],
             [
              0.8888888888888888,
              "#fdca26"
             ],
             [
              1,
              "#f0f921"
             ]
            ],
            "type": "heatmapgl"
           }
          ],
          "histogram": [
           {
            "marker": {
             "pattern": {
              "fillmode": "overlay",
              "size": 10,
              "solidity": 0.2
             }
            },
            "type": "histogram"
           }
          ],
          "histogram2d": [
           {
            "colorbar": {
             "outlinewidth": 0,
             "ticks": ""
            },
            "colorscale": [
             [
              0,
              "#0d0887"
             ],
             [
              0.1111111111111111,
              "#46039f"
             ],
             [
              0.2222222222222222,
              "#7201a8"
             ],
             [
              0.3333333333333333,
              "#9c179e"
             ],
             [
              0.4444444444444444,
              "#bd3786"
             ],
             [
              0.5555555555555556,
              "#d8576b"
             ],
             [
              0.6666666666666666,
              "#ed7953"
             ],
             [
              0.7777777777777778,
              "#fb9f3a"
             ],
             [
              0.8888888888888888,
              "#fdca26"
             ],
             [
              1,
              "#f0f921"
             ]
            ],
            "type": "histogram2d"
           }
          ],
          "histogram2dcontour": [
           {
            "colorbar": {
             "outlinewidth": 0,
             "ticks": ""
            },
            "colorscale": [
             [
              0,
              "#0d0887"
             ],
             [
              0.1111111111111111,
              "#46039f"
             ],
             [
              0.2222222222222222,
              "#7201a8"
             ],
             [
              0.3333333333333333,
              "#9c179e"
             ],
             [
              0.4444444444444444,
              "#bd3786"
             ],
             [
              0.5555555555555556,
              "#d8576b"
             ],
             [
              0.6666666666666666,
              "#ed7953"
             ],
             [
              0.7777777777777778,
              "#fb9f3a"
             ],
             [
              0.8888888888888888,
              "#fdca26"
             ],
             [
              1,
              "#f0f921"
             ]
            ],
            "type": "histogram2dcontour"
           }
          ],
          "mesh3d": [
           {
            "colorbar": {
             "outlinewidth": 0,
             "ticks": ""
            },
            "type": "mesh3d"
           }
          ],
          "parcoords": [
           {
            "line": {
             "colorbar": {
              "outlinewidth": 0,
              "ticks": ""
             }
            },
            "type": "parcoords"
           }
          ],
          "pie": [
           {
            "automargin": true,
            "type": "pie"
           }
          ],
          "scatter": [
           {
            "fillpattern": {
             "fillmode": "overlay",
             "size": 10,
             "solidity": 0.2
            },
            "type": "scatter"
           }
          ],
          "scatter3d": [
           {
            "line": {
             "colorbar": {
              "outlinewidth": 0,
              "ticks": ""
             }
            },
            "marker": {
             "colorbar": {
              "outlinewidth": 0,
              "ticks": ""
             }
            },
            "type": "scatter3d"
           }
          ],
          "scattercarpet": [
           {
            "marker": {
             "colorbar": {
              "outlinewidth": 0,
              "ticks": ""
             }
            },
            "type": "scattercarpet"
           }
          ],
          "scattergeo": [
           {
            "marker": {
             "colorbar": {
              "outlinewidth": 0,
              "ticks": ""
             }
            },
            "type": "scattergeo"
           }
          ],
          "scattergl": [
           {
            "marker": {
             "colorbar": {
              "outlinewidth": 0,
              "ticks": ""
             }
            },
            "type": "scattergl"
           }
          ],
          "scattermapbox": [
           {
            "marker": {
             "colorbar": {
              "outlinewidth": 0,
              "ticks": ""
             }
            },
            "type": "scattermapbox"
           }
          ],
          "scatterpolar": [
           {
            "marker": {
             "colorbar": {
              "outlinewidth": 0,
              "ticks": ""
             }
            },
            "type": "scatterpolar"
           }
          ],
          "scatterpolargl": [
           {
            "marker": {
             "colorbar": {
              "outlinewidth": 0,
              "ticks": ""
             }
            },
            "type": "scatterpolargl"
           }
          ],
          "scatterternary": [
           {
            "marker": {
             "colorbar": {
              "outlinewidth": 0,
              "ticks": ""
             }
            },
            "type": "scatterternary"
           }
          ],
          "surface": [
           {
            "colorbar": {
             "outlinewidth": 0,
             "ticks": ""
            },
            "colorscale": [
             [
              0,
              "#0d0887"
             ],
             [
              0.1111111111111111,
              "#46039f"
             ],
             [
              0.2222222222222222,
              "#7201a8"
             ],
             [
              0.3333333333333333,
              "#9c179e"
             ],
             [
              0.4444444444444444,
              "#bd3786"
             ],
             [
              0.5555555555555556,
              "#d8576b"
             ],
             [
              0.6666666666666666,
              "#ed7953"
             ],
             [
              0.7777777777777778,
              "#fb9f3a"
             ],
             [
              0.8888888888888888,
              "#fdca26"
             ],
             [
              1,
              "#f0f921"
             ]
            ],
            "type": "surface"
           }
          ],
          "table": [
           {
            "cells": {
             "fill": {
              "color": "#EBF0F8"
             },
             "line": {
              "color": "white"
             }
            },
            "header": {
             "fill": {
              "color": "#C8D4E3"
             },
             "line": {
              "color": "white"
             }
            },
            "type": "table"
           }
          ]
         },
         "layout": {
          "annotationdefaults": {
           "arrowcolor": "#2a3f5f",
           "arrowhead": 0,
           "arrowwidth": 1
          },
          "autotypenumbers": "strict",
          "coloraxis": {
           "colorbar": {
            "outlinewidth": 0,
            "ticks": ""
           }
          },
          "colorscale": {
           "diverging": [
            [
             0,
             "#8e0152"
            ],
            [
             0.1,
             "#c51b7d"
            ],
            [
             0.2,
             "#de77ae"
            ],
            [
             0.3,
             "#f1b6da"
            ],
            [
             0.4,
             "#fde0ef"
            ],
            [
             0.5,
             "#f7f7f7"
            ],
            [
             0.6,
             "#e6f5d0"
            ],
            [
             0.7,
             "#b8e186"
            ],
            [
             0.8,
             "#7fbc41"
            ],
            [
             0.9,
             "#4d9221"
            ],
            [
             1,
             "#276419"
            ]
           ],
           "sequential": [
            [
             0,
             "#0d0887"
            ],
            [
             0.1111111111111111,
             "#46039f"
            ],
            [
             0.2222222222222222,
             "#7201a8"
            ],
            [
             0.3333333333333333,
             "#9c179e"
            ],
            [
             0.4444444444444444,
             "#bd3786"
            ],
            [
             0.5555555555555556,
             "#d8576b"
            ],
            [
             0.6666666666666666,
             "#ed7953"
            ],
            [
             0.7777777777777778,
             "#fb9f3a"
            ],
            [
             0.8888888888888888,
             "#fdca26"
            ],
            [
             1,
             "#f0f921"
            ]
           ],
           "sequentialminus": [
            [
             0,
             "#0d0887"
            ],
            [
             0.1111111111111111,
             "#46039f"
            ],
            [
             0.2222222222222222,
             "#7201a8"
            ],
            [
             0.3333333333333333,
             "#9c179e"
            ],
            [
             0.4444444444444444,
             "#bd3786"
            ],
            [
             0.5555555555555556,
             "#d8576b"
            ],
            [
             0.6666666666666666,
             "#ed7953"
            ],
            [
             0.7777777777777778,
             "#fb9f3a"
            ],
            [
             0.8888888888888888,
             "#fdca26"
            ],
            [
             1,
             "#f0f921"
            ]
           ]
          },
          "colorway": [
           "#636efa",
           "#EF553B",
           "#00cc96",
           "#ab63fa",
           "#FFA15A",
           "#19d3f3",
           "#FF6692",
           "#B6E880",
           "#FF97FF",
           "#FECB52"
          ],
          "font": {
           "color": "#2a3f5f"
          },
          "geo": {
           "bgcolor": "white",
           "lakecolor": "white",
           "landcolor": "#E5ECF6",
           "showlakes": true,
           "showland": true,
           "subunitcolor": "white"
          },
          "hoverlabel": {
           "align": "left"
          },
          "hovermode": "closest",
          "mapbox": {
           "style": "light"
          },
          "paper_bgcolor": "white",
          "plot_bgcolor": "#E5ECF6",
          "polar": {
           "angularaxis": {
            "gridcolor": "white",
            "linecolor": "white",
            "ticks": ""
           },
           "bgcolor": "#E5ECF6",
           "radialaxis": {
            "gridcolor": "white",
            "linecolor": "white",
            "ticks": ""
           }
          },
          "scene": {
           "xaxis": {
            "backgroundcolor": "#E5ECF6",
            "gridcolor": "white",
            "gridwidth": 2,
            "linecolor": "white",
            "showbackground": true,
            "ticks": "",
            "zerolinecolor": "white"
           },
           "yaxis": {
            "backgroundcolor": "#E5ECF6",
            "gridcolor": "white",
            "gridwidth": 2,
            "linecolor": "white",
            "showbackground": true,
            "ticks": "",
            "zerolinecolor": "white"
           },
           "zaxis": {
            "backgroundcolor": "#E5ECF6",
            "gridcolor": "white",
            "gridwidth": 2,
            "linecolor": "white",
            "showbackground": true,
            "ticks": "",
            "zerolinecolor": "white"
           }
          },
          "shapedefaults": {
           "line": {
            "color": "#2a3f5f"
           }
          },
          "ternary": {
           "aaxis": {
            "gridcolor": "white",
            "linecolor": "white",
            "ticks": ""
           },
           "baxis": {
            "gridcolor": "white",
            "linecolor": "white",
            "ticks": ""
           },
           "bgcolor": "#E5ECF6",
           "caxis": {
            "gridcolor": "white",
            "linecolor": "white",
            "ticks": ""
           }
          },
          "title": {
           "x": 0.05
          },
          "xaxis": {
           "automargin": true,
           "gridcolor": "white",
           "linecolor": "white",
           "ticks": "",
           "title": {
            "standoff": 15
           },
           "zerolinecolor": "white",
           "zerolinewidth": 2
          },
          "yaxis": {
           "automargin": true,
           "gridcolor": "white",
           "linecolor": "white",
           "ticks": "",
           "title": {
            "standoff": 15
           },
           "zerolinecolor": "white",
           "zerolinewidth": 2
          }
         }
        },
        "xaxis": {
         "anchor": "y",
         "domain": [
          0,
          1
         ],
         "title": {
          "text": "填写问卷时长"
         }
        },
        "yaxis": {
         "anchor": "x",
         "domain": [
          0,
          1
         ],
         "title": {
          "text": "count"
         }
        }
       }
      }
     },
     "metadata": {},
     "output_type": "display_data"
    }
   ],
   "source": [
    "fig = px.histogram(df4, x=\"填写问卷时长\")\n",
    "fig.show()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 34,
   "metadata": {},
   "outputs": [],
   "source": [
    "## 逻辑一致性检查\n",
    "df5 = df4.drop(df4.query('(填写问卷时长 >600) or (填写问卷时长 <= 50)').index)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 35,
   "metadata": {},
   "outputs": [],
   "source": [
    "# 数据清理完毕\n",
    "\n",
    "df = df5.copy()"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "# 数据分析\n",
    "\n",
    "## 描述统计\n",
    "\n",
    "先描述样本背景，对样本质量进行评价。再描述样本特征信息、样本基本现状，最后描述样本基本态度及其他维度。\n",
    "\n",
    "描述统计分析也应该有理论依据或概念合理的分类。\n"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 36,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>次数</th>\n",
       "      <th>比例</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>AI绘画对传统绘画的冲击</th>\n",
       "      <td>54</td>\n",
       "      <td>39.705882</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>AI绘画推广过程中涉及的版权问题</th>\n",
       "      <td>57</td>\n",
       "      <td>41.911765</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>AI绘画工作的成本与效率</th>\n",
       "      <td>67</td>\n",
       "      <td>49.264706</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>AI绘画带来的商业价值</th>\n",
       "      <td>74</td>\n",
       "      <td>54.411765</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>受众对AI绘画的认可程度</th>\n",
       "      <td>94</td>\n",
       "      <td>69.117647</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "</div>"
      ],
      "text/plain": [
       "                  次数         比例\n",
       "AI绘画对传统绘画的冲击      54  39.705882\n",
       "AI绘画推广过程中涉及的版权问题  57  41.911765\n",
       "AI绘画工作的成本与效率      67  49.264706\n",
       "AI绘画带来的商业价值       74  54.411765\n",
       "受众对AI绘画的认可程度      94  69.117647"
      ]
     },
     "execution_count": 36,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "important_factors = mytools.gen_mcq_df(df,'7、假如你是AI绘画研发人员，在AI绘画推广过程中，你更看重？(多选)')\n",
    "important_factors = important_factors.sort_values(by='比例')\n",
    "important_factors"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 37,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "application/vnd.plotly.v1+json": {
       "config": {
        "plotlyServerURL": "https://plot.ly"
       },
       "data": [
        {
         "alignmentgroup": "True",
         "hovertemplate": "比例=%{x}<br>index=%{y}<extra></extra>",
         "legendgroup": "",
         "marker": {
          "color": "#636efa",
          "pattern": {
           "shape": ""
          }
         },
         "name": "",
         "offsetgroup": "",
         "orientation": "h",
         "showlegend": false,
         "textposition": "auto",
         "type": "bar",
         "x": [
          39.705882352941174,
          41.911764705882355,
          49.26470588235294,
          54.41176470588235,
          69.11764705882352
         ],
         "xaxis": "x",
         "y": [
          "AI绘画对传统绘画的冲击",
          "AI绘画推广过程中涉及的版权问题",
          "AI绘画工作的成本与效率",
          "AI绘画带来的商业价值",
          "受众对AI绘画的认可程度"
         ],
         "yaxis": "y"
        }
       ],
       "layout": {
        "barmode": "relative",
        "legend": {
         "tracegroupgap": 0
        },
        "margin": {
         "t": 60
        },
        "template": {
         "data": {
          "bar": [
           {
            "error_x": {
             "color": "#2a3f5f"
            },
            "error_y": {
             "color": "#2a3f5f"
            },
            "marker": {
             "line": {
              "color": "#E5ECF6",
              "width": 0.5
             },
             "pattern": {
              "fillmode": "overlay",
              "size": 10,
              "solidity": 0.2
             }
            },
            "type": "bar"
           }
          ],
          "barpolar": [
           {
            "marker": {
             "line": {
              "color": "#E5ECF6",
              "width": 0.5
             },
             "pattern": {
              "fillmode": "overlay",
              "size": 10,
              "solidity": 0.2
             }
            },
            "type": "barpolar"
           }
          ],
          "carpet": [
           {
            "aaxis": {
             "endlinecolor": "#2a3f5f",
             "gridcolor": "white",
             "linecolor": "white",
             "minorgridcolor": "white",
             "startlinecolor": "#2a3f5f"
            },
            "baxis": {
             "endlinecolor": "#2a3f5f",
             "gridcolor": "white",
             "linecolor": "white",
             "minorgridcolor": "white",
             "startlinecolor": "#2a3f5f"
            },
            "type": "carpet"
           }
          ],
          "choropleth": [
           {
            "colorbar": {
             "outlinewidth": 0,
             "ticks": ""
            },
            "type": "choropleth"
           }
          ],
          "contour": [
           {
            "colorbar": {
             "outlinewidth": 0,
             "ticks": ""
            },
            "colorscale": [
             [
              0,
              "#0d0887"
             ],
             [
              0.1111111111111111,
              "#46039f"
             ],
             [
              0.2222222222222222,
              "#7201a8"
             ],
             [
              0.3333333333333333,
              "#9c179e"
             ],
             [
              0.4444444444444444,
              "#bd3786"
             ],
             [
              0.5555555555555556,
              "#d8576b"
             ],
             [
              0.6666666666666666,
              "#ed7953"
             ],
             [
              0.7777777777777778,
              "#fb9f3a"
             ],
             [
              0.8888888888888888,
              "#fdca26"
             ],
             [
              1,
              "#f0f921"
             ]
            ],
            "type": "contour"
           }
          ],
          "contourcarpet": [
           {
            "colorbar": {
             "outlinewidth": 0,
             "ticks": ""
            },
            "type": "contourcarpet"
           }
          ],
          "heatmap": [
           {
            "colorbar": {
             "outlinewidth": 0,
             "ticks": ""
            },
            "colorscale": [
             [
              0,
              "#0d0887"
             ],
             [
              0.1111111111111111,
              "#46039f"
             ],
             [
              0.2222222222222222,
              "#7201a8"
             ],
             [
              0.3333333333333333,
              "#9c179e"
             ],
             [
              0.4444444444444444,
              "#bd3786"
             ],
             [
              0.5555555555555556,
              "#d8576b"
             ],
             [
              0.6666666666666666,
              "#ed7953"
             ],
             [
              0.7777777777777778,
              "#fb9f3a"
             ],
             [
              0.8888888888888888,
              "#fdca26"
             ],
             [
              1,
              "#f0f921"
             ]
            ],
            "type": "heatmap"
           }
          ],
          "heatmapgl": [
           {
            "colorbar": {
             "outlinewidth": 0,
             "ticks": ""
            },
            "colorscale": [
             [
              0,
              "#0d0887"
             ],
             [
              0.1111111111111111,
              "#46039f"
             ],
             [
              0.2222222222222222,
              "#7201a8"
             ],
             [
              0.3333333333333333,
              "#9c179e"
             ],
             [
              0.4444444444444444,
              "#bd3786"
             ],
             [
              0.5555555555555556,
              "#d8576b"
             ],
             [
              0.6666666666666666,
              "#ed7953"
             ],
             [
              0.7777777777777778,
              "#fb9f3a"
             ],
             [
              0.8888888888888888,
              "#fdca26"
             ],
             [
              1,
              "#f0f921"
             ]
            ],
            "type": "heatmapgl"
           }
          ],
          "histogram": [
           {
            "marker": {
             "pattern": {
              "fillmode": "overlay",
              "size": 10,
              "solidity": 0.2
             }
            },
            "type": "histogram"
           }
          ],
          "histogram2d": [
           {
            "colorbar": {
             "outlinewidth": 0,
             "ticks": ""
            },
            "colorscale": [
             [
              0,
              "#0d0887"
             ],
             [
              0.1111111111111111,
              "#46039f"
             ],
             [
              0.2222222222222222,
              "#7201a8"
             ],
             [
              0.3333333333333333,
              "#9c179e"
             ],
             [
              0.4444444444444444,
              "#bd3786"
             ],
             [
              0.5555555555555556,
              "#d8576b"
             ],
             [
              0.6666666666666666,
              "#ed7953"
             ],
             [
              0.7777777777777778,
              "#fb9f3a"
             ],
             [
              0.8888888888888888,
              "#fdca26"
             ],
             [
              1,
              "#f0f921"
             ]
            ],
            "type": "histogram2d"
           }
          ],
          "histogram2dcontour": [
           {
            "colorbar": {
             "outlinewidth": 0,
             "ticks": ""
            },
            "colorscale": [
             [
              0,
              "#0d0887"
             ],
             [
              0.1111111111111111,
              "#46039f"
             ],
             [
              0.2222222222222222,
              "#7201a8"
             ],
             [
              0.3333333333333333,
              "#9c179e"
             ],
             [
              0.4444444444444444,
              "#bd3786"
             ],
             [
              0.5555555555555556,
              "#d8576b"
             ],
             [
              0.6666666666666666,
              "#ed7953"
             ],
             [
              0.7777777777777778,
              "#fb9f3a"
             ],
             [
              0.8888888888888888,
              "#fdca26"
             ],
             [
              1,
              "#f0f921"
             ]
            ],
            "type": "histogram2dcontour"
           }
          ],
          "mesh3d": [
           {
            "colorbar": {
             "outlinewidth": 0,
             "ticks": ""
            },
            "type": "mesh3d"
           }
          ],
          "parcoords": [
           {
            "line": {
             "colorbar": {
              "outlinewidth": 0,
              "ticks": ""
             }
            },
            "type": "parcoords"
           }
          ],
          "pie": [
           {
            "automargin": true,
            "type": "pie"
           }
          ],
          "scatter": [
           {
            "fillpattern": {
             "fillmode": "overlay",
             "size": 10,
             "solidity": 0.2
            },
            "type": "scatter"
           }
          ],
          "scatter3d": [
           {
            "line": {
             "colorbar": {
              "outlinewidth": 0,
              "ticks": ""
             }
            },
            "marker": {
             "colorbar": {
              "outlinewidth": 0,
              "ticks": ""
             }
            },
            "type": "scatter3d"
           }
          ],
          "scattercarpet": [
           {
            "marker": {
             "colorbar": {
              "outlinewidth": 0,
              "ticks": ""
             }
            },
            "type": "scattercarpet"
           }
          ],
          "scattergeo": [
           {
            "marker": {
             "colorbar": {
              "outlinewidth": 0,
              "ticks": ""
             }
            },
            "type": "scattergeo"
           }
          ],
          "scattergl": [
           {
            "marker": {
             "colorbar": {
              "outlinewidth": 0,
              "ticks": ""
             }
            },
            "type": "scattergl"
           }
          ],
          "scattermapbox": [
           {
            "marker": {
             "colorbar": {
              "outlinewidth": 0,
              "ticks": ""
             }
            },
            "type": "scattermapbox"
           }
          ],
          "scatterpolar": [
           {
            "marker": {
             "colorbar": {
              "outlinewidth": 0,
              "ticks": ""
             }
            },
            "type": "scatterpolar"
           }
          ],
          "scatterpolargl": [
           {
            "marker": {
             "colorbar": {
              "outlinewidth": 0,
              "ticks": ""
             }
            },
            "type": "scatterpolargl"
           }
          ],
          "scatterternary": [
           {
            "marker": {
             "colorbar": {
              "outlinewidth": 0,
              "ticks": ""
             }
            },
            "type": "scatterternary"
           }
          ],
          "surface": [
           {
            "colorbar": {
             "outlinewidth": 0,
             "ticks": ""
            },
            "colorscale": [
             [
              0,
              "#0d0887"
             ],
             [
              0.1111111111111111,
              "#46039f"
             ],
             [
              0.2222222222222222,
              "#7201a8"
             ],
             [
              0.3333333333333333,
              "#9c179e"
             ],
             [
              0.4444444444444444,
              "#bd3786"
             ],
             [
              0.5555555555555556,
              "#d8576b"
             ],
             [
              0.6666666666666666,
              "#ed7953"
             ],
             [
              0.7777777777777778,
              "#fb9f3a"
             ],
             [
              0.8888888888888888,
              "#fdca26"
             ],
             [
              1,
              "#f0f921"
             ]
            ],
            "type": "surface"
           }
          ],
          "table": [
           {
            "cells": {
             "fill": {
              "color": "#EBF0F8"
             },
             "line": {
              "color": "white"
             }
            },
            "header": {
             "fill": {
              "color": "#C8D4E3"
             },
             "line": {
              "color": "white"
             }
            },
            "type": "table"
           }
          ]
         },
         "layout": {
          "annotationdefaults": {
           "arrowcolor": "#2a3f5f",
           "arrowhead": 0,
           "arrowwidth": 1
          },
          "autotypenumbers": "strict",
          "coloraxis": {
           "colorbar": {
            "outlinewidth": 0,
            "ticks": ""
           }
          },
          "colorscale": {
           "diverging": [
            [
             0,
             "#8e0152"
            ],
            [
             0.1,
             "#c51b7d"
            ],
            [
             0.2,
             "#de77ae"
            ],
            [
             0.3,
             "#f1b6da"
            ],
            [
             0.4,
             "#fde0ef"
            ],
            [
             0.5,
             "#f7f7f7"
            ],
            [
             0.6,
             "#e6f5d0"
            ],
            [
             0.7,
             "#b8e186"
            ],
            [
             0.8,
             "#7fbc41"
            ],
            [
             0.9,
             "#4d9221"
            ],
            [
             1,
             "#276419"
            ]
           ],
           "sequential": [
            [
             0,
             "#0d0887"
            ],
            [
             0.1111111111111111,
             "#46039f"
            ],
            [
             0.2222222222222222,
             "#7201a8"
            ],
            [
             0.3333333333333333,
             "#9c179e"
            ],
            [
             0.4444444444444444,
             "#bd3786"
            ],
            [
             0.5555555555555556,
             "#d8576b"
            ],
            [
             0.6666666666666666,
             "#ed7953"
            ],
            [
             0.7777777777777778,
             "#fb9f3a"
            ],
            [
             0.8888888888888888,
             "#fdca26"
            ],
            [
             1,
             "#f0f921"
            ]
           ],
           "sequentialminus": [
            [
             0,
             "#0d0887"
            ],
            [
             0.1111111111111111,
             "#46039f"
            ],
            [
             0.2222222222222222,
             "#7201a8"
            ],
            [
             0.3333333333333333,
             "#9c179e"
            ],
            [
             0.4444444444444444,
             "#bd3786"
            ],
            [
             0.5555555555555556,
             "#d8576b"
            ],
            [
             0.6666666666666666,
             "#ed7953"
            ],
            [
             0.7777777777777778,
             "#fb9f3a"
            ],
            [
             0.8888888888888888,
             "#fdca26"
            ],
            [
             1,
             "#f0f921"
            ]
           ]
          },
          "colorway": [
           "#636efa",
           "#EF553B",
           "#00cc96",
           "#ab63fa",
           "#FFA15A",
           "#19d3f3",
           "#FF6692",
           "#B6E880",
           "#FF97FF",
           "#FECB52"
          ],
          "font": {
           "color": "#2a3f5f"
          },
          "geo": {
           "bgcolor": "white",
           "lakecolor": "white",
           "landcolor": "#E5ECF6",
           "showlakes": true,
           "showland": true,
           "subunitcolor": "white"
          },
          "hoverlabel": {
           "align": "left"
          },
          "hovermode": "closest",
          "mapbox": {
           "style": "light"
          },
          "paper_bgcolor": "white",
          "plot_bgcolor": "#E5ECF6",
          "polar": {
           "angularaxis": {
            "gridcolor": "white",
            "linecolor": "white",
            "ticks": ""
           },
           "bgcolor": "#E5ECF6",
           "radialaxis": {
            "gridcolor": "white",
            "linecolor": "white",
            "ticks": ""
           }
          },
          "scene": {
           "xaxis": {
            "backgroundcolor": "#E5ECF6",
            "gridcolor": "white",
            "gridwidth": 2,
            "linecolor": "white",
            "showbackground": true,
            "ticks": "",
            "zerolinecolor": "white"
           },
           "yaxis": {
            "backgroundcolor": "#E5ECF6",
            "gridcolor": "white",
            "gridwidth": 2,
            "linecolor": "white",
            "showbackground": true,
            "ticks": "",
            "zerolinecolor": "white"
           },
           "zaxis": {
            "backgroundcolor": "#E5ECF6",
            "gridcolor": "white",
            "gridwidth": 2,
            "linecolor": "white",
            "showbackground": true,
            "ticks": "",
            "zerolinecolor": "white"
           }
          },
          "shapedefaults": {
           "line": {
            "color": "#2a3f5f"
           }
          },
          "ternary": {
           "aaxis": {
            "gridcolor": "white",
            "linecolor": "white",
            "ticks": ""
           },
           "baxis": {
            "gridcolor": "white",
            "linecolor": "white",
            "ticks": ""
           },
           "bgcolor": "#E5ECF6",
           "caxis": {
            "gridcolor": "white",
            "linecolor": "white",
            "ticks": ""
           }
          },
          "title": {
           "x": 0.05
          },
          "xaxis": {
           "automargin": true,
           "gridcolor": "white",
           "linecolor": "white",
           "ticks": "",
           "title": {
            "standoff": 15
           },
           "zerolinecolor": "white",
           "zerolinewidth": 2
          },
          "yaxis": {
           "automargin": true,
           "gridcolor": "white",
           "linecolor": "white",
           "ticks": "",
           "title": {
            "standoff": 15
           },
           "zerolinecolor": "white",
           "zerolinewidth": 2
          }
         }
        },
        "xaxis": {
         "anchor": "y",
         "domain": [
          0,
          1
         ],
         "title": {
          "text": "比例"
         }
        },
        "yaxis": {
         "anchor": "x",
         "domain": [
          0,
          1
         ],
         "title": {
          "text": "index"
         }
        }
       }
      }
     },
     "metadata": {},
     "output_type": "display_data"
    }
   ],
   "source": [
    "fig = px.bar(important_factors, x=\"比例\",orientation='h')\n",
    "fig.show()"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## 推论统计\n",
    "\n",
    "对研究假设逐一进行检验。\n",
    "\n",
    "为检验研究假设，需要首先构造研究假设中的自变量（批判性思维能力）、因变量（对待AI作品的态度）"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 38,
   "metadata": {},
   "outputs": [],
   "source": [
    "\"\"\"\n",
    "生成自变量：批判性思维能力\n",
    "批判性思维能力 = 22、对于新事物，我喜欢去尝试和体验 + 21、在面对各种相互对立的想法时，我喜欢确定哪一种是做某件事情的正确方式和方法\t\n",
    "\"\"\"\n",
    "df['批判性思维能力'] = df['22、对于新事物，我喜欢去尝试和体验']+df['21、在面对各种相互对立的想法时，我喜欢确定哪一种是做某件事情的正确方式和方法']\n",
    "# df['批判性思维能力'] = df['22、对于新事物，我喜欢去尝试和体验']"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 39,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "count    136.000000\n",
       "mean     137.985294\n",
       "std       33.043627\n",
       "min       59.000000\n",
       "25%      116.000000\n",
       "50%      133.000000\n",
       "75%      161.250000\n",
       "max      200.000000\n",
       "Name: 批判性思维能力, dtype: float64"
      ]
     },
     "execution_count": 39,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "df['批判性思维能力'].describe()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 40,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "application/vnd.plotly.v1+json": {
       "config": {
        "plotlyServerURL": "https://plot.ly"
       },
       "data": [
        {
         "alignmentgroup": "True",
         "bingroup": "x",
         "hovertemplate": "批判性思维能力=%{x}<br>count=%{y}<extra></extra>",
         "legendgroup": "",
         "marker": {
          "color": "#636efa",
          "pattern": {
           "shape": ""
          }
         },
         "name": "",
         "offsetgroup": "",
         "orientation": "v",
         "showlegend": false,
         "type": "histogram",
         "x": [
          146,
          131,
          112,
          98,
          173,
          156,
          110,
          121,
          132,
          105,
          110,
          88,
          142,
          72,
          153,
          123,
          179,
          200,
          103,
          141,
          82,
          200,
          91,
          131,
          110,
          70,
          96,
          162,
          144,
          121,
          112,
          120,
          115,
          180,
          95,
          162,
          158,
          145,
          174,
          178,
          85,
          153,
          200,
          98,
          179,
          121,
          200,
          200,
          183,
          200,
          200,
          170,
          123,
          170,
          135,
          141,
          156,
          200,
          122,
          171,
          129,
          70,
          157,
          116,
          87,
          168,
          139,
          119,
          144,
          124,
          179,
          174,
          163,
          128,
          109,
          158,
          159,
          136,
          116,
          110,
          193,
          108,
          127,
          99,
          143,
          185,
          151,
          133,
          125,
          171,
          133,
          159,
          123,
          122,
          120,
          142,
          104,
          132,
          102,
          122,
          112,
          177,
          123,
          146,
          59,
          154,
          117,
          141,
          132,
          112,
          141,
          130,
          177,
          137,
          161,
          200,
          98,
          181,
          68,
          145,
          119,
          150,
          131,
          118,
          100,
          132,
          166,
          200,
          110,
          141,
          130,
          131,
          150,
          184,
          134,
          132
         ],
         "xaxis": "x",
         "yaxis": "y"
        }
       ],
       "layout": {
        "barmode": "relative",
        "legend": {
         "tracegroupgap": 0
        },
        "margin": {
         "t": 60
        },
        "template": {
         "data": {
          "bar": [
           {
            "error_x": {
             "color": "#2a3f5f"
            },
            "error_y": {
             "color": "#2a3f5f"
            },
            "marker": {
             "line": {
              "color": "#E5ECF6",
              "width": 0.5
             },
             "pattern": {
              "fillmode": "overlay",
              "size": 10,
              "solidity": 0.2
             }
            },
            "type": "bar"
           }
          ],
          "barpolar": [
           {
            "marker": {
             "line": {
              "color": "#E5ECF6",
              "width": 0.5
             },
             "pattern": {
              "fillmode": "overlay",
              "size": 10,
              "solidity": 0.2
             }
            },
            "type": "barpolar"
           }
          ],
          "carpet": [
           {
            "aaxis": {
             "endlinecolor": "#2a3f5f",
             "gridcolor": "white",
             "linecolor": "white",
             "minorgridcolor": "white",
             "startlinecolor": "#2a3f5f"
            },
            "baxis": {
             "endlinecolor": "#2a3f5f",
             "gridcolor": "white",
             "linecolor": "white",
             "minorgridcolor": "white",
             "startlinecolor": "#2a3f5f"
            },
            "type": "carpet"
           }
          ],
          "choropleth": [
           {
            "colorbar": {
             "outlinewidth": 0,
             "ticks": ""
            },
            "type": "choropleth"
           }
          ],
          "contour": [
           {
            "colorbar": {
             "outlinewidth": 0,
             "ticks": ""
            },
            "colorscale": [
             [
              0,
              "#0d0887"
             ],
             [
              0.1111111111111111,
              "#46039f"
             ],
             [
              0.2222222222222222,
              "#7201a8"
             ],
             [
              0.3333333333333333,
              "#9c179e"
             ],
             [
              0.4444444444444444,
              "#bd3786"
             ],
             [
              0.5555555555555556,
              "#d8576b"
             ],
             [
              0.6666666666666666,
              "#ed7953"
             ],
             [
              0.7777777777777778,
              "#fb9f3a"
             ],
             [
              0.8888888888888888,
              "#fdca26"
             ],
             [
              1,
              "#f0f921"
             ]
            ],
            "type": "contour"
           }
          ],
          "contourcarpet": [
           {
            "colorbar": {
             "outlinewidth": 0,
             "ticks": ""
            },
            "type": "contourcarpet"
           }
          ],
          "heatmap": [
           {
            "colorbar": {
             "outlinewidth": 0,
             "ticks": ""
            },
            "colorscale": [
             [
              0,
              "#0d0887"
             ],
             [
              0.1111111111111111,
              "#46039f"
             ],
             [
              0.2222222222222222,
              "#7201a8"
             ],
             [
              0.3333333333333333,
              "#9c179e"
             ],
             [
              0.4444444444444444,
              "#bd3786"
             ],
             [
              0.5555555555555556,
              "#d8576b"
             ],
             [
              0.6666666666666666,
              "#ed7953"
             ],
             [
              0.7777777777777778,
              "#fb9f3a"
             ],
             [
              0.8888888888888888,
              "#fdca26"
             ],
             [
              1,
              "#f0f921"
             ]
            ],
            "type": "heatmap"
           }
          ],
          "heatmapgl": [
           {
            "colorbar": {
             "outlinewidth": 0,
             "ticks": ""
            },
            "colorscale": [
             [
              0,
              "#0d0887"
             ],
             [
              0.1111111111111111,
              "#46039f"
             ],
             [
              0.2222222222222222,
              "#7201a8"
             ],
             [
              0.3333333333333333,
              "#9c179e"
             ],
             [
              0.4444444444444444,
              "#bd3786"
             ],
             [
              0.5555555555555556,
              "#d8576b"
             ],
             [
              0.6666666666666666,
              "#ed7953"
             ],
             [
              0.7777777777777778,
              "#fb9f3a"
             ],
             [
              0.8888888888888888,
              "#fdca26"
             ],
             [
              1,
              "#f0f921"
             ]
            ],
            "type": "heatmapgl"
           }
          ],
          "histogram": [
           {
            "marker": {
             "pattern": {
              "fillmode": "overlay",
              "size": 10,
              "solidity": 0.2
             }
            },
            "type": "histogram"
           }
          ],
          "histogram2d": [
           {
            "colorbar": {
             "outlinewidth": 0,
             "ticks": ""
            },
            "colorscale": [
             [
              0,
              "#0d0887"
             ],
             [
              0.1111111111111111,
              "#46039f"
             ],
             [
              0.2222222222222222,
              "#7201a8"
             ],
             [
              0.3333333333333333,
              "#9c179e"
             ],
             [
              0.4444444444444444,
              "#bd3786"
             ],
             [
              0.5555555555555556,
              "#d8576b"
             ],
             [
              0.6666666666666666,
              "#ed7953"
             ],
             [
              0.7777777777777778,
              "#fb9f3a"
             ],
             [
              0.8888888888888888,
              "#fdca26"
             ],
             [
              1,
              "#f0f921"
             ]
            ],
            "type": "histogram2d"
           }
          ],
          "histogram2dcontour": [
           {
            "colorbar": {
             "outlinewidth": 0,
             "ticks": ""
            },
            "colorscale": [
             [
              0,
              "#0d0887"
             ],
             [
              0.1111111111111111,
              "#46039f"
             ],
             [
              0.2222222222222222,
              "#7201a8"
             ],
             [
              0.3333333333333333,
              "#9c179e"
             ],
             [
              0.4444444444444444,
              "#bd3786"
             ],
             [
              0.5555555555555556,
              "#d8576b"
             ],
             [
              0.6666666666666666,
              "#ed7953"
             ],
             [
              0.7777777777777778,
              "#fb9f3a"
             ],
             [
              0.8888888888888888,
              "#fdca26"
             ],
             [
              1,
              "#f0f921"
             ]
            ],
            "type": "histogram2dcontour"
           }
          ],
          "mesh3d": [
           {
            "colorbar": {
             "outlinewidth": 0,
             "ticks": ""
            },
            "type": "mesh3d"
           }
          ],
          "parcoords": [
           {
            "line": {
             "colorbar": {
              "outlinewidth": 0,
              "ticks": ""
             }
            },
            "type": "parcoords"
           }
          ],
          "pie": [
           {
            "automargin": true,
            "type": "pie"
           }
          ],
          "scatter": [
           {
            "fillpattern": {
             "fillmode": "overlay",
             "size": 10,
             "solidity": 0.2
            },
            "type": "scatter"
           }
          ],
          "scatter3d": [
           {
            "line": {
             "colorbar": {
              "outlinewidth": 0,
              "ticks": ""
             }
            },
            "marker": {
             "colorbar": {
              "outlinewidth": 0,
              "ticks": ""
             }
            },
            "type": "scatter3d"
           }
          ],
          "scattercarpet": [
           {
            "marker": {
             "colorbar": {
              "outlinewidth": 0,
              "ticks": ""
             }
            },
            "type": "scattercarpet"
           }
          ],
          "scattergeo": [
           {
            "marker": {
             "colorbar": {
              "outlinewidth": 0,
              "ticks": ""
             }
            },
            "type": "scattergeo"
           }
          ],
          "scattergl": [
           {
            "marker": {
             "colorbar": {
              "outlinewidth": 0,
              "ticks": ""
             }
            },
            "type": "scattergl"
           }
          ],
          "scattermapbox": [
           {
            "marker": {
             "colorbar": {
              "outlinewidth": 0,
              "ticks": ""
             }
            },
            "type": "scattermapbox"
           }
          ],
          "scatterpolar": [
           {
            "marker": {
             "colorbar": {
              "outlinewidth": 0,
              "ticks": ""
             }
            },
            "type": "scatterpolar"
           }
          ],
          "scatterpolargl": [
           {
            "marker": {
             "colorbar": {
              "outlinewidth": 0,
              "ticks": ""
             }
            },
            "type": "scatterpolargl"
           }
          ],
          "scatterternary": [
           {
            "marker": {
             "colorbar": {
              "outlinewidth": 0,
              "ticks": ""
             }
            },
            "type": "scatterternary"
           }
          ],
          "surface": [
           {
            "colorbar": {
             "outlinewidth": 0,
             "ticks": ""
            },
            "colorscale": [
             [
              0,
              "#0d0887"
             ],
             [
              0.1111111111111111,
              "#46039f"
             ],
             [
              0.2222222222222222,
              "#7201a8"
             ],
             [
              0.3333333333333333,
              "#9c179e"
             ],
             [
              0.4444444444444444,
              "#bd3786"
             ],
             [
              0.5555555555555556,
              "#d8576b"
             ],
             [
              0.6666666666666666,
              "#ed7953"
             ],
             [
              0.7777777777777778,
              "#fb9f3a"
             ],
             [
              0.8888888888888888,
              "#fdca26"
             ],
             [
              1,
              "#f0f921"
             ]
            ],
            "type": "surface"
           }
          ],
          "table": [
           {
            "cells": {
             "fill": {
              "color": "#EBF0F8"
             },
             "line": {
              "color": "white"
             }
            },
            "header": {
             "fill": {
              "color": "#C8D4E3"
             },
             "line": {
              "color": "white"
             }
            },
            "type": "table"
           }
          ]
         },
         "layout": {
          "annotationdefaults": {
           "arrowcolor": "#2a3f5f",
           "arrowhead": 0,
           "arrowwidth": 1
          },
          "autotypenumbers": "strict",
          "coloraxis": {
           "colorbar": {
            "outlinewidth": 0,
            "ticks": ""
           }
          },
          "colorscale": {
           "diverging": [
            [
             0,
             "#8e0152"
            ],
            [
             0.1,
             "#c51b7d"
            ],
            [
             0.2,
             "#de77ae"
            ],
            [
             0.3,
             "#f1b6da"
            ],
            [
             0.4,
             "#fde0ef"
            ],
            [
             0.5,
             "#f7f7f7"
            ],
            [
             0.6,
             "#e6f5d0"
            ],
            [
             0.7,
             "#b8e186"
            ],
            [
             0.8,
             "#7fbc41"
            ],
            [
             0.9,
             "#4d9221"
            ],
            [
             1,
             "#276419"
            ]
           ],
           "sequential": [
            [
             0,
             "#0d0887"
            ],
            [
             0.1111111111111111,
             "#46039f"
            ],
            [
             0.2222222222222222,
             "#7201a8"
            ],
            [
             0.3333333333333333,
             "#9c179e"
            ],
            [
             0.4444444444444444,
             "#bd3786"
            ],
            [
             0.5555555555555556,
             "#d8576b"
            ],
            [
             0.6666666666666666,
             "#ed7953"
            ],
            [
             0.7777777777777778,
             "#fb9f3a"
            ],
            [
             0.8888888888888888,
             "#fdca26"
            ],
            [
             1,
             "#f0f921"
            ]
           ],
           "sequentialminus": [
            [
             0,
             "#0d0887"
            ],
            [
             0.1111111111111111,
             "#46039f"
            ],
            [
             0.2222222222222222,
             "#7201a8"
            ],
            [
             0.3333333333333333,
             "#9c179e"
            ],
            [
             0.4444444444444444,
             "#bd3786"
            ],
            [
             0.5555555555555556,
             "#d8576b"
            ],
            [
             0.6666666666666666,
             "#ed7953"
            ],
            [
             0.7777777777777778,
             "#fb9f3a"
            ],
            [
             0.8888888888888888,
             "#fdca26"
            ],
            [
             1,
             "#f0f921"
            ]
           ]
          },
          "colorway": [
           "#636efa",
           "#EF553B",
           "#00cc96",
           "#ab63fa",
           "#FFA15A",
           "#19d3f3",
           "#FF6692",
           "#B6E880",
           "#FF97FF",
           "#FECB52"
          ],
          "font": {
           "color": "#2a3f5f"
          },
          "geo": {
           "bgcolor": "white",
           "lakecolor": "white",
           "landcolor": "#E5ECF6",
           "showlakes": true,
           "showland": true,
           "subunitcolor": "white"
          },
          "hoverlabel": {
           "align": "left"
          },
          "hovermode": "closest",
          "mapbox": {
           "style": "light"
          },
          "paper_bgcolor": "white",
          "plot_bgcolor": "#E5ECF6",
          "polar": {
           "angularaxis": {
            "gridcolor": "white",
            "linecolor": "white",
            "ticks": ""
           },
           "bgcolor": "#E5ECF6",
           "radialaxis": {
            "gridcolor": "white",
            "linecolor": "white",
            "ticks": ""
           }
          },
          "scene": {
           "xaxis": {
            "backgroundcolor": "#E5ECF6",
            "gridcolor": "white",
            "gridwidth": 2,
            "linecolor": "white",
            "showbackground": true,
            "ticks": "",
            "zerolinecolor": "white"
           },
           "yaxis": {
            "backgroundcolor": "#E5ECF6",
            "gridcolor": "white",
            "gridwidth": 2,
            "linecolor": "white",
            "showbackground": true,
            "ticks": "",
            "zerolinecolor": "white"
           },
           "zaxis": {
            "backgroundcolor": "#E5ECF6",
            "gridcolor": "white",
            "gridwidth": 2,
            "linecolor": "white",
            "showbackground": true,
            "ticks": "",
            "zerolinecolor": "white"
           }
          },
          "shapedefaults": {
           "line": {
            "color": "#2a3f5f"
           }
          },
          "ternary": {
           "aaxis": {
            "gridcolor": "white",
            "linecolor": "white",
            "ticks": ""
           },
           "baxis": {
            "gridcolor": "white",
            "linecolor": "white",
            "ticks": ""
           },
           "bgcolor": "#E5ECF6",
           "caxis": {
            "gridcolor": "white",
            "linecolor": "white",
            "ticks": ""
           }
          },
          "title": {
           "x": 0.05
          },
          "xaxis": {
           "automargin": true,
           "gridcolor": "white",
           "linecolor": "white",
           "ticks": "",
           "title": {
            "standoff": 15
           },
           "zerolinecolor": "white",
           "zerolinewidth": 2
          },
          "yaxis": {
           "automargin": true,
           "gridcolor": "white",
           "linecolor": "white",
           "ticks": "",
           "title": {
            "standoff": 15
           },
           "zerolinecolor": "white",
           "zerolinewidth": 2
          }
         }
        },
        "xaxis": {
         "anchor": "y",
         "domain": [
          0,
          1
         ],
         "title": {
          "text": "批判性思维能力"
         }
        },
        "yaxis": {
         "anchor": "x",
         "domain": [
          0,
          1
         ],
         "title": {
          "text": "count"
         }
        }
       }
      }
     },
     "metadata": {},
     "output_type": "display_data"
    }
   ],
   "source": [
    "fig = px.histogram(df, x=\"批判性思维能力\")\n",
    "fig.show()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 17,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "Index(['其他', '其他〖ai作画挺欣赏的，但它是融合了其他画手的成果，感官复杂〗', '其他〖看不出来〗', '对于两者都喜欢，都可接受',\n",
       "       '更喜欢AI作品，全新的视觉体验给观者带来愉悦的感觉', '更喜欢感受传统及现有艺术作品的魅力'],\n",
       "      dtype='object')"
      ]
     },
     "execution_count": 17,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "df['9、当您作为观看者时，请问您更喜欢观赏传统及现有绘画艺术作品还是AI(绘画)艺术作品?'].cat.categories"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 41,
   "metadata": {},
   "outputs": [],
   "source": [
    "\"\"\"\n",
    "生成因变量：对待AI作品的态度（分值越高，态度越积极）\n",
    "对待AI作品的态度 = 8、请问你认为借助AI创作出的作品可以被称为艺术品吗? + 9、\t当您作为观看者时，请问您更喜欢观赏传统及现有绘画艺术作品还是AI(绘画)艺术作品?\n",
    "\"\"\"\n",
    "def re_gen_attitude1(x):\n",
    "    \"\"\"\n",
    "    依据变量的取值，重新生成变量\n",
    "    \"\"\"\n",
    "    if x == \"不可以，只是新兴技术在其他领域的具体体现\":\n",
    "        return -1\n",
    "    elif x == \"可以，是理性与感性的结合\":\n",
    "        return 1\n",
    "    else:\n",
    "        return 0\n",
    "def re_gen_attitude2(x):\n",
    "    \"\"\"\n",
    "    依据变量的取值，重新生成变量\n",
    "    \"\"\"\n",
    "    if x == \"更喜欢感受传统及现有艺术作品的魅力\":\n",
    "        return -1\n",
    "    elif x == \"更喜欢AI作品，全新的视觉体验给观者带来愉悦的感觉\":\n",
    "        return 1\n",
    "    else:\n",
    "        return 0\n",
    "df['对待AI作品的态度'] = df['8、请问你认为借助AI创作出的作品可以被称为艺术品吗?'].apply(re_gen_attitude1) + df['9、当您作为观看者时，请问您更喜欢观赏传统及现有绘画艺术作品还是AI(绘画)艺术作品?'].apply(re_gen_attitude2)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 42,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "application/vnd.plotly.v1+json": {
       "config": {
        "plotlyServerURL": "https://plot.ly"
       },
       "data": [
        {
         "alignmentgroup": "True",
         "bingroup": "x",
         "hovertemplate": "对待AI作品的态度=%{x}<br>count=%{y}<extra></extra>",
         "legendgroup": "",
         "marker": {
          "color": "#636efa",
          "pattern": {
           "shape": ""
          }
         },
         "name": "",
         "offsetgroup": "",
         "orientation": "v",
         "showlegend": false,
         "type": "histogram",
         "x": [
          -1,
          2,
          -1,
          -2,
          2,
          -1,
          1,
          0,
          -2,
          0,
          -1,
          0,
          -1,
          0,
          -2,
          0,
          0,
          -1,
          1,
          -1,
          1,
          2,
          0,
          0,
          0,
          0,
          2,
          1,
          -1,
          -1,
          0,
          0,
          1,
          0,
          0,
          0,
          2,
          -1,
          1,
          1,
          0,
          -1,
          -1,
          0,
          0,
          0,
          0,
          2,
          -1,
          0,
          2,
          -1,
          -1,
          1,
          1,
          0,
          2,
          2,
          0,
          -1,
          1,
          0,
          -1,
          -1,
          2,
          -2,
          1,
          0,
          -2,
          -1,
          -1,
          -1,
          0,
          -1,
          1,
          -2,
          -1,
          -1,
          -2,
          -1,
          0,
          -2,
          0,
          0,
          0,
          1,
          0,
          1,
          -2,
          -1,
          2,
          -1,
          1,
          0,
          -1,
          -1,
          -2,
          -1,
          0,
          -1,
          1,
          -2,
          -2,
          1,
          0,
          0,
          -2,
          -1,
          0,
          1,
          0,
          0,
          -1,
          1,
          0,
          -1,
          0,
          -1,
          0,
          0,
          -1,
          0,
          -1,
          0,
          -1,
          0,
          0,
          -1,
          -1,
          0,
          0,
          0,
          0,
          0,
          -1,
          2
         ],
         "xaxis": "x",
         "yaxis": "y"
        }
       ],
       "layout": {
        "barmode": "relative",
        "legend": {
         "tracegroupgap": 0
        },
        "margin": {
         "t": 60
        },
        "template": {
         "data": {
          "bar": [
           {
            "error_x": {
             "color": "#2a3f5f"
            },
            "error_y": {
             "color": "#2a3f5f"
            },
            "marker": {
             "line": {
              "color": "#E5ECF6",
              "width": 0.5
             },
             "pattern": {
              "fillmode": "overlay",
              "size": 10,
              "solidity": 0.2
             }
            },
            "type": "bar"
           }
          ],
          "barpolar": [
           {
            "marker": {
             "line": {
              "color": "#E5ECF6",
              "width": 0.5
             },
             "pattern": {
              "fillmode": "overlay",
              "size": 10,
              "solidity": 0.2
             }
            },
            "type": "barpolar"
           }
          ],
          "carpet": [
           {
            "aaxis": {
             "endlinecolor": "#2a3f5f",
             "gridcolor": "white",
             "linecolor": "white",
             "minorgridcolor": "white",
             "startlinecolor": "#2a3f5f"
            },
            "baxis": {
             "endlinecolor": "#2a3f5f",
             "gridcolor": "white",
             "linecolor": "white",
             "minorgridcolor": "white",
             "startlinecolor": "#2a3f5f"
            },
            "type": "carpet"
           }
          ],
          "choropleth": [
           {
            "colorbar": {
             "outlinewidth": 0,
             "ticks": ""
            },
            "type": "choropleth"
           }
          ],
          "contour": [
           {
            "colorbar": {
             "outlinewidth": 0,
             "ticks": ""
            },
            "colorscale": [
             [
              0,
              "#0d0887"
             ],
             [
              0.1111111111111111,
              "#46039f"
             ],
             [
              0.2222222222222222,
              "#7201a8"
             ],
             [
              0.3333333333333333,
              "#9c179e"
             ],
             [
              0.4444444444444444,
              "#bd3786"
             ],
             [
              0.5555555555555556,
              "#d8576b"
             ],
             [
              0.6666666666666666,
              "#ed7953"
             ],
             [
              0.7777777777777778,
              "#fb9f3a"
             ],
             [
              0.8888888888888888,
              "#fdca26"
             ],
             [
              1,
              "#f0f921"
             ]
            ],
            "type": "contour"
           }
          ],
          "contourcarpet": [
           {
            "colorbar": {
             "outlinewidth": 0,
             "ticks": ""
            },
            "type": "contourcarpet"
           }
          ],
          "heatmap": [
           {
            "colorbar": {
             "outlinewidth": 0,
             "ticks": ""
            },
            "colorscale": [
             [
              0,
              "#0d0887"
             ],
             [
              0.1111111111111111,
              "#46039f"
             ],
             [
              0.2222222222222222,
              "#7201a8"
             ],
             [
              0.3333333333333333,
              "#9c179e"
             ],
             [
              0.4444444444444444,
              "#bd3786"
             ],
             [
              0.5555555555555556,
              "#d8576b"
             ],
             [
              0.6666666666666666,
              "#ed7953"
             ],
             [
              0.7777777777777778,
              "#fb9f3a"
             ],
             [
              0.8888888888888888,
              "#fdca26"
             ],
             [
              1,
              "#f0f921"
             ]
            ],
            "type": "heatmap"
           }
          ],
          "heatmapgl": [
           {
            "colorbar": {
             "outlinewidth": 0,
             "ticks": ""
            },
            "colorscale": [
             [
              0,
              "#0d0887"
             ],
             [
              0.1111111111111111,
              "#46039f"
             ],
             [
              0.2222222222222222,
              "#7201a8"
             ],
             [
              0.3333333333333333,
              "#9c179e"
             ],
             [
              0.4444444444444444,
              "#bd3786"
             ],
             [
              0.5555555555555556,
              "#d8576b"
             ],
             [
              0.6666666666666666,
              "#ed7953"
             ],
             [
              0.7777777777777778,
              "#fb9f3a"
             ],
             [
              0.8888888888888888,
              "#fdca26"
             ],
             [
              1,
              "#f0f921"
             ]
            ],
            "type": "heatmapgl"
           }
          ],
          "histogram": [
           {
            "marker": {
             "pattern": {
              "fillmode": "overlay",
              "size": 10,
              "solidity": 0.2
             }
            },
            "type": "histogram"
           }
          ],
          "histogram2d": [
           {
            "colorbar": {
             "outlinewidth": 0,
             "ticks": ""
            },
            "colorscale": [
             [
              0,
              "#0d0887"
             ],
             [
              0.1111111111111111,
              "#46039f"
             ],
             [
              0.2222222222222222,
              "#7201a8"
             ],
             [
              0.3333333333333333,
              "#9c179e"
             ],
             [
              0.4444444444444444,
              "#bd3786"
             ],
             [
              0.5555555555555556,
              "#d8576b"
             ],
             [
              0.6666666666666666,
              "#ed7953"
             ],
             [
              0.7777777777777778,
              "#fb9f3a"
             ],
             [
              0.8888888888888888,
              "#fdca26"
             ],
             [
              1,
              "#f0f921"
             ]
            ],
            "type": "histogram2d"
           }
          ],
          "histogram2dcontour": [
           {
            "colorbar": {
             "outlinewidth": 0,
             "ticks": ""
            },
            "colorscale": [
             [
              0,
              "#0d0887"
             ],
             [
              0.1111111111111111,
              "#46039f"
             ],
             [
              0.2222222222222222,
              "#7201a8"
             ],
             [
              0.3333333333333333,
              "#9c179e"
             ],
             [
              0.4444444444444444,
              "#bd3786"
             ],
             [
              0.5555555555555556,
              "#d8576b"
             ],
             [
              0.6666666666666666,
              "#ed7953"
             ],
             [
              0.7777777777777778,
              "#fb9f3a"
             ],
             [
              0.8888888888888888,
              "#fdca26"
             ],
             [
              1,
              "#f0f921"
             ]
            ],
            "type": "histogram2dcontour"
           }
          ],
          "mesh3d": [
           {
            "colorbar": {
             "outlinewidth": 0,
             "ticks": ""
            },
            "type": "mesh3d"
           }
          ],
          "parcoords": [
           {
            "line": {
             "colorbar": {
              "outlinewidth": 0,
              "ticks": ""
             }
            },
            "type": "parcoords"
           }
          ],
          "pie": [
           {
            "automargin": true,
            "type": "pie"
           }
          ],
          "scatter": [
           {
            "fillpattern": {
             "fillmode": "overlay",
             "size": 10,
             "solidity": 0.2
            },
            "type": "scatter"
           }
          ],
          "scatter3d": [
           {
            "line": {
             "colorbar": {
              "outlinewidth": 0,
              "ticks": ""
             }
            },
            "marker": {
             "colorbar": {
              "outlinewidth": 0,
              "ticks": ""
             }
            },
            "type": "scatter3d"
           }
          ],
          "scattercarpet": [
           {
            "marker": {
             "colorbar": {
              "outlinewidth": 0,
              "ticks": ""
             }
            },
            "type": "scattercarpet"
           }
          ],
          "scattergeo": [
           {
            "marker": {
             "colorbar": {
              "outlinewidth": 0,
              "ticks": ""
             }
            },
            "type": "scattergeo"
           }
          ],
          "scattergl": [
           {
            "marker": {
             "colorbar": {
              "outlinewidth": 0,
              "ticks": ""
             }
            },
            "type": "scattergl"
           }
          ],
          "scattermapbox": [
           {
            "marker": {
             "colorbar": {
              "outlinewidth": 0,
              "ticks": ""
             }
            },
            "type": "scattermapbox"
           }
          ],
          "scatterpolar": [
           {
            "marker": {
             "colorbar": {
              "outlinewidth": 0,
              "ticks": ""
             }
            },
            "type": "scatterpolar"
           }
          ],
          "scatterpolargl": [
           {
            "marker": {
             "colorbar": {
              "outlinewidth": 0,
              "ticks": ""
             }
            },
            "type": "scatterpolargl"
           }
          ],
          "scatterternary": [
           {
            "marker": {
             "colorbar": {
              "outlinewidth": 0,
              "ticks": ""
             }
            },
            "type": "scatterternary"
           }
          ],
          "surface": [
           {
            "colorbar": {
             "outlinewidth": 0,
             "ticks": ""
            },
            "colorscale": [
             [
              0,
              "#0d0887"
             ],
             [
              0.1111111111111111,
              "#46039f"
             ],
             [
              0.2222222222222222,
              "#7201a8"
             ],
             [
              0.3333333333333333,
              "#9c179e"
             ],
             [
              0.4444444444444444,
              "#bd3786"
             ],
             [
              0.5555555555555556,
              "#d8576b"
             ],
             [
              0.6666666666666666,
              "#ed7953"
             ],
             [
              0.7777777777777778,
              "#fb9f3a"
             ],
             [
              0.8888888888888888,
              "#fdca26"
             ],
             [
              1,
              "#f0f921"
             ]
            ],
            "type": "surface"
           }
          ],
          "table": [
           {
            "cells": {
             "fill": {
              "color": "#EBF0F8"
             },
             "line": {
              "color": "white"
             }
            },
            "header": {
             "fill": {
              "color": "#C8D4E3"
             },
             "line": {
              "color": "white"
             }
            },
            "type": "table"
           }
          ]
         },
         "layout": {
          "annotationdefaults": {
           "arrowcolor": "#2a3f5f",
           "arrowhead": 0,
           "arrowwidth": 1
          },
          "autotypenumbers": "strict",
          "coloraxis": {
           "colorbar": {
            "outlinewidth": 0,
            "ticks": ""
           }
          },
          "colorscale": {
           "diverging": [
            [
             0,
             "#8e0152"
            ],
            [
             0.1,
             "#c51b7d"
            ],
            [
             0.2,
             "#de77ae"
            ],
            [
             0.3,
             "#f1b6da"
            ],
            [
             0.4,
             "#fde0ef"
            ],
            [
             0.5,
             "#f7f7f7"
            ],
            [
             0.6,
             "#e6f5d0"
            ],
            [
             0.7,
             "#b8e186"
            ],
            [
             0.8,
             "#7fbc41"
            ],
            [
             0.9,
             "#4d9221"
            ],
            [
             1,
             "#276419"
            ]
           ],
           "sequential": [
            [
             0,
             "#0d0887"
            ],
            [
             0.1111111111111111,
             "#46039f"
            ],
            [
             0.2222222222222222,
             "#7201a8"
            ],
            [
             0.3333333333333333,
             "#9c179e"
            ],
            [
             0.4444444444444444,
             "#bd3786"
            ],
            [
             0.5555555555555556,
             "#d8576b"
            ],
            [
             0.6666666666666666,
             "#ed7953"
            ],
            [
             0.7777777777777778,
             "#fb9f3a"
            ],
            [
             0.8888888888888888,
             "#fdca26"
            ],
            [
             1,
             "#f0f921"
            ]
           ],
           "sequentialminus": [
            [
             0,
             "#0d0887"
            ],
            [
             0.1111111111111111,
             "#46039f"
            ],
            [
             0.2222222222222222,
             "#7201a8"
            ],
            [
             0.3333333333333333,
             "#9c179e"
            ],
            [
             0.4444444444444444,
             "#bd3786"
            ],
            [
             0.5555555555555556,
             "#d8576b"
            ],
            [
             0.6666666666666666,
             "#ed7953"
            ],
            [
             0.7777777777777778,
             "#fb9f3a"
            ],
            [
             0.8888888888888888,
             "#fdca26"
            ],
            [
             1,
             "#f0f921"
            ]
           ]
          },
          "colorway": [
           "#636efa",
           "#EF553B",
           "#00cc96",
           "#ab63fa",
           "#FFA15A",
           "#19d3f3",
           "#FF6692",
           "#B6E880",
           "#FF97FF",
           "#FECB52"
          ],
          "font": {
           "color": "#2a3f5f"
          },
          "geo": {
           "bgcolor": "white",
           "lakecolor": "white",
           "landcolor": "#E5ECF6",
           "showlakes": true,
           "showland": true,
           "subunitcolor": "white"
          },
          "hoverlabel": {
           "align": "left"
          },
          "hovermode": "closest",
          "mapbox": {
           "style": "light"
          },
          "paper_bgcolor": "white",
          "plot_bgcolor": "#E5ECF6",
          "polar": {
           "angularaxis": {
            "gridcolor": "white",
            "linecolor": "white",
            "ticks": ""
           },
           "bgcolor": "#E5ECF6",
           "radialaxis": {
            "gridcolor": "white",
            "linecolor": "white",
            "ticks": ""
           }
          },
          "scene": {
           "xaxis": {
            "backgroundcolor": "#E5ECF6",
            "gridcolor": "white",
            "gridwidth": 2,
            "linecolor": "white",
            "showbackground": true,
            "ticks": "",
            "zerolinecolor": "white"
           },
           "yaxis": {
            "backgroundcolor": "#E5ECF6",
            "gridcolor": "white",
            "gridwidth": 2,
            "linecolor": "white",
            "showbackground": true,
            "ticks": "",
            "zerolinecolor": "white"
           },
           "zaxis": {
            "backgroundcolor": "#E5ECF6",
            "gridcolor": "white",
            "gridwidth": 2,
            "linecolor": "white",
            "showbackground": true,
            "ticks": "",
            "zerolinecolor": "white"
           }
          },
          "shapedefaults": {
           "line": {
            "color": "#2a3f5f"
           }
          },
          "ternary": {
           "aaxis": {
            "gridcolor": "white",
            "linecolor": "white",
            "ticks": ""
           },
           "baxis": {
            "gridcolor": "white",
            "linecolor": "white",
            "ticks": ""
           },
           "bgcolor": "#E5ECF6",
           "caxis": {
            "gridcolor": "white",
            "linecolor": "white",
            "ticks": ""
           }
          },
          "title": {
           "x": 0.05
          },
          "xaxis": {
           "automargin": true,
           "gridcolor": "white",
           "linecolor": "white",
           "ticks": "",
           "title": {
            "standoff": 15
           },
           "zerolinecolor": "white",
           "zerolinewidth": 2
          },
          "yaxis": {
           "automargin": true,
           "gridcolor": "white",
           "linecolor": "white",
           "ticks": "",
           "title": {
            "standoff": 15
           },
           "zerolinecolor": "white",
           "zerolinewidth": 2
          }
         }
        },
        "xaxis": {
         "anchor": "y",
         "domain": [
          0,
          1
         ],
         "title": {
          "text": "对待AI作品的态度"
         }
        },
        "yaxis": {
         "anchor": "x",
         "domain": [
          0,
          1
         ],
         "title": {
          "text": "count"
         }
        }
       }
      }
     },
     "metadata": {},
     "output_type": "display_data"
    }
   ],
   "source": [
    "fig = px.histogram(df, x=\"对待AI作品的态度\")\n",
    "fig.show()"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## 假设检验\n",
    "\n",
    "可将自变量和因变量视为定距变量，采用R方描述相关性，采用F检验进行假设检验。"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 43,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "application/vnd.plotly.v1+json": {
       "config": {
        "plotlyServerURL": "https://plot.ly"
       },
       "data": [
        {
         "hovertemplate": "批判性思维能力=%{x}<br>对待AI作品的态度=%{y}<extra></extra>",
         "legendgroup": "",
         "marker": {
          "color": "#636efa",
          "symbol": "circle"
         },
         "mode": "markers",
         "name": "",
         "orientation": "v",
         "showlegend": false,
         "type": "scatter",
         "x": [
          146,
          131,
          112,
          98,
          173,
          156,
          110,
          121,
          132,
          105,
          110,
          88,
          142,
          72,
          153,
          123,
          179,
          200,
          103,
          141,
          82,
          200,
          91,
          131,
          110,
          70,
          96,
          162,
          144,
          121,
          112,
          120,
          115,
          180,
          95,
          162,
          158,
          145,
          174,
          178,
          85,
          153,
          200,
          98,
          179,
          121,
          200,
          200,
          183,
          200,
          200,
          170,
          123,
          170,
          135,
          141,
          156,
          200,
          122,
          171,
          129,
          70,
          157,
          116,
          87,
          168,
          139,
          119,
          144,
          124,
          179,
          174,
          163,
          128,
          109,
          158,
          159,
          136,
          116,
          110,
          193,
          108,
          127,
          99,
          143,
          185,
          151,
          133,
          125,
          171,
          133,
          159,
          123,
          122,
          120,
          142,
          104,
          132,
          102,
          122,
          112,
          177,
          123,
          146,
          59,
          154,
          117,
          141,
          132,
          112,
          141,
          130,
          177,
          137,
          161,
          200,
          98,
          181,
          68,
          145,
          119,
          150,
          131,
          118,
          100,
          132,
          166,
          200,
          110,
          141,
          130,
          131,
          150,
          184,
          134,
          132
         ],
         "xaxis": "x",
         "y": [
          -1,
          2,
          -1,
          -2,
          2,
          -1,
          1,
          0,
          -2,
          0,
          -1,
          0,
          -1,
          0,
          -2,
          0,
          0,
          -1,
          1,
          -1,
          1,
          2,
          0,
          0,
          0,
          0,
          2,
          1,
          -1,
          -1,
          0,
          0,
          1,
          0,
          0,
          0,
          2,
          -1,
          1,
          1,
          0,
          -1,
          -1,
          0,
          0,
          0,
          0,
          2,
          -1,
          0,
          2,
          -1,
          -1,
          1,
          1,
          0,
          2,
          2,
          0,
          -1,
          1,
          0,
          -1,
          -1,
          2,
          -2,
          1,
          0,
          -2,
          -1,
          -1,
          -1,
          0,
          -1,
          1,
          -2,
          -1,
          -1,
          -2,
          -1,
          0,
          -2,
          0,
          0,
          0,
          1,
          0,
          1,
          -2,
          -1,
          2,
          -1,
          1,
          0,
          -1,
          -1,
          -2,
          -1,
          0,
          -1,
          1,
          -2,
          -2,
          1,
          0,
          0,
          -2,
          -1,
          0,
          1,
          0,
          0,
          -1,
          1,
          0,
          -1,
          0,
          -1,
          0,
          0,
          -1,
          0,
          -1,
          0,
          -1,
          0,
          0,
          -1,
          -1,
          0,
          0,
          0,
          0,
          0,
          -1,
          2
         ],
         "yaxis": "y"
        }
       ],
       "layout": {
        "legend": {
         "tracegroupgap": 0
        },
        "margin": {
         "t": 60
        },
        "template": {
         "data": {
          "bar": [
           {
            "error_x": {
             "color": "#2a3f5f"
            },
            "error_y": {
             "color": "#2a3f5f"
            },
            "marker": {
             "line": {
              "color": "#E5ECF6",
              "width": 0.5
             },
             "pattern": {
              "fillmode": "overlay",
              "size": 10,
              "solidity": 0.2
             }
            },
            "type": "bar"
           }
          ],
          "barpolar": [
           {
            "marker": {
             "line": {
              "color": "#E5ECF6",
              "width": 0.5
             },
             "pattern": {
              "fillmode": "overlay",
              "size": 10,
              "solidity": 0.2
             }
            },
            "type": "barpolar"
           }
          ],
          "carpet": [
           {
            "aaxis": {
             "endlinecolor": "#2a3f5f",
             "gridcolor": "white",
             "linecolor": "white",
             "minorgridcolor": "white",
             "startlinecolor": "#2a3f5f"
            },
            "baxis": {
             "endlinecolor": "#2a3f5f",
             "gridcolor": "white",
             "linecolor": "white",
             "minorgridcolor": "white",
             "startlinecolor": "#2a3f5f"
            },
            "type": "carpet"
           }
          ],
          "choropleth": [
           {
            "colorbar": {
             "outlinewidth": 0,
             "ticks": ""
            },
            "type": "choropleth"
           }
          ],
          "contour": [
           {
            "colorbar": {
             "outlinewidth": 0,
             "ticks": ""
            },
            "colorscale": [
             [
              0,
              "#0d0887"
             ],
             [
              0.1111111111111111,
              "#46039f"
             ],
             [
              0.2222222222222222,
              "#7201a8"
             ],
             [
              0.3333333333333333,
              "#9c179e"
             ],
             [
              0.4444444444444444,
              "#bd3786"
             ],
             [
              0.5555555555555556,
              "#d8576b"
             ],
             [
              0.6666666666666666,
              "#ed7953"
             ],
             [
              0.7777777777777778,
              "#fb9f3a"
             ],
             [
              0.8888888888888888,
              "#fdca26"
             ],
             [
              1,
              "#f0f921"
             ]
            ],
            "type": "contour"
           }
          ],
          "contourcarpet": [
           {
            "colorbar": {
             "outlinewidth": 0,
             "ticks": ""
            },
            "type": "contourcarpet"
           }
          ],
          "heatmap": [
           {
            "colorbar": {
             "outlinewidth": 0,
             "ticks": ""
            },
            "colorscale": [
             [
              0,
              "#0d0887"
             ],
             [
              0.1111111111111111,
              "#46039f"
             ],
             [
              0.2222222222222222,
              "#7201a8"
             ],
             [
              0.3333333333333333,
              "#9c179e"
             ],
             [
              0.4444444444444444,
              "#bd3786"
             ],
             [
              0.5555555555555556,
              "#d8576b"
             ],
             [
              0.6666666666666666,
              "#ed7953"
             ],
             [
              0.7777777777777778,
              "#fb9f3a"
             ],
             [
              0.8888888888888888,
              "#fdca26"
             ],
             [
              1,
              "#f0f921"
             ]
            ],
            "type": "heatmap"
           }
          ],
          "heatmapgl": [
           {
            "colorbar": {
             "outlinewidth": 0,
             "ticks": ""
            },
            "colorscale": [
             [
              0,
              "#0d0887"
             ],
             [
              0.1111111111111111,
              "#46039f"
             ],
             [
              0.2222222222222222,
              "#7201a8"
             ],
             [
              0.3333333333333333,
              "#9c179e"
             ],
             [
              0.4444444444444444,
              "#bd3786"
             ],
             [
              0.5555555555555556,
              "#d8576b"
             ],
             [
              0.6666666666666666,
              "#ed7953"
             ],
             [
              0.7777777777777778,
              "#fb9f3a"
             ],
             [
              0.8888888888888888,
              "#fdca26"
             ],
             [
              1,
              "#f0f921"
             ]
            ],
            "type": "heatmapgl"
           }
          ],
          "histogram": [
           {
            "marker": {
             "pattern": {
              "fillmode": "overlay",
              "size": 10,
              "solidity": 0.2
             }
            },
            "type": "histogram"
           }
          ],
          "histogram2d": [
           {
            "colorbar": {
             "outlinewidth": 0,
             "ticks": ""
            },
            "colorscale": [
             [
              0,
              "#0d0887"
             ],
             [
              0.1111111111111111,
              "#46039f"
             ],
             [
              0.2222222222222222,
              "#7201a8"
             ],
             [
              0.3333333333333333,
              "#9c179e"
             ],
             [
              0.4444444444444444,
              "#bd3786"
             ],
             [
              0.5555555555555556,
              "#d8576b"
             ],
             [
              0.6666666666666666,
              "#ed7953"
             ],
             [
              0.7777777777777778,
              "#fb9f3a"
             ],
             [
              0.8888888888888888,
              "#fdca26"
             ],
             [
              1,
              "#f0f921"
             ]
            ],
            "type": "histogram2d"
           }
          ],
          "histogram2dcontour": [
           {
            "colorbar": {
             "outlinewidth": 0,
             "ticks": ""
            },
            "colorscale": [
             [
              0,
              "#0d0887"
             ],
             [
              0.1111111111111111,
              "#46039f"
             ],
             [
              0.2222222222222222,
              "#7201a8"
             ],
             [
              0.3333333333333333,
              "#9c179e"
             ],
             [
              0.4444444444444444,
              "#bd3786"
             ],
             [
              0.5555555555555556,
              "#d8576b"
             ],
             [
              0.6666666666666666,
              "#ed7953"
             ],
             [
              0.7777777777777778,
              "#fb9f3a"
             ],
             [
              0.8888888888888888,
              "#fdca26"
             ],
             [
              1,
              "#f0f921"
             ]
            ],
            "type": "histogram2dcontour"
           }
          ],
          "mesh3d": [
           {
            "colorbar": {
             "outlinewidth": 0,
             "ticks": ""
            },
            "type": "mesh3d"
           }
          ],
          "parcoords": [
           {
            "line": {
             "colorbar": {
              "outlinewidth": 0,
              "ticks": ""
             }
            },
            "type": "parcoords"
           }
          ],
          "pie": [
           {
            "automargin": true,
            "type": "pie"
           }
          ],
          "scatter": [
           {
            "fillpattern": {
             "fillmode": "overlay",
             "size": 10,
             "solidity": 0.2
            },
            "type": "scatter"
           }
          ],
          "scatter3d": [
           {
            "line": {
             "colorbar": {
              "outlinewidth": 0,
              "ticks": ""
             }
            },
            "marker": {
             "colorbar": {
              "outlinewidth": 0,
              "ticks": ""
             }
            },
            "type": "scatter3d"
           }
          ],
          "scattercarpet": [
           {
            "marker": {
             "colorbar": {
              "outlinewidth": 0,
              "ticks": ""
             }
            },
            "type": "scattercarpet"
           }
          ],
          "scattergeo": [
           {
            "marker": {
             "colorbar": {
              "outlinewidth": 0,
              "ticks": ""
             }
            },
            "type": "scattergeo"
           }
          ],
          "scattergl": [
           {
            "marker": {
             "colorbar": {
              "outlinewidth": 0,
              "ticks": ""
             }
            },
            "type": "scattergl"
           }
          ],
          "scattermapbox": [
           {
            "marker": {
             "colorbar": {
              "outlinewidth": 0,
              "ticks": ""
             }
            },
            "type": "scattermapbox"
           }
          ],
          "scatterpolar": [
           {
            "marker": {
             "colorbar": {
              "outlinewidth": 0,
              "ticks": ""
             }
            },
            "type": "scatterpolar"
           }
          ],
          "scatterpolargl": [
           {
            "marker": {
             "colorbar": {
              "outlinewidth": 0,
              "ticks": ""
             }
            },
            "type": "scatterpolargl"
           }
          ],
          "scatterternary": [
           {
            "marker": {
             "colorbar": {
              "outlinewidth": 0,
              "ticks": ""
             }
            },
            "type": "scatterternary"
           }
          ],
          "surface": [
           {
            "colorbar": {
             "outlinewidth": 0,
             "ticks": ""
            },
            "colorscale": [
             [
              0,
              "#0d0887"
             ],
             [
              0.1111111111111111,
              "#46039f"
             ],
             [
              0.2222222222222222,
              "#7201a8"
             ],
             [
              0.3333333333333333,
              "#9c179e"
             ],
             [
              0.4444444444444444,
              "#bd3786"
             ],
             [
              0.5555555555555556,
              "#d8576b"
             ],
             [
              0.6666666666666666,
              "#ed7953"
             ],
             [
              0.7777777777777778,
              "#fb9f3a"
             ],
             [
              0.8888888888888888,
              "#fdca26"
             ],
             [
              1,
              "#f0f921"
             ]
            ],
            "type": "surface"
           }
          ],
          "table": [
           {
            "cells": {
             "fill": {
              "color": "#EBF0F8"
             },
             "line": {
              "color": "white"
             }
            },
            "header": {
             "fill": {
              "color": "#C8D4E3"
             },
             "line": {
              "color": "white"
             }
            },
            "type": "table"
           }
          ]
         },
         "layout": {
          "annotationdefaults": {
           "arrowcolor": "#2a3f5f",
           "arrowhead": 0,
           "arrowwidth": 1
          },
          "autotypenumbers": "strict",
          "coloraxis": {
           "colorbar": {
            "outlinewidth": 0,
            "ticks": ""
           }
          },
          "colorscale": {
           "diverging": [
            [
             0,
             "#8e0152"
            ],
            [
             0.1,
             "#c51b7d"
            ],
            [
             0.2,
             "#de77ae"
            ],
            [
             0.3,
             "#f1b6da"
            ],
            [
             0.4,
             "#fde0ef"
            ],
            [
             0.5,
             "#f7f7f7"
            ],
            [
             0.6,
             "#e6f5d0"
            ],
            [
             0.7,
             "#b8e186"
            ],
            [
             0.8,
             "#7fbc41"
            ],
            [
             0.9,
             "#4d9221"
            ],
            [
             1,
             "#276419"
            ]
           ],
           "sequential": [
            [
             0,
             "#0d0887"
            ],
            [
             0.1111111111111111,
             "#46039f"
            ],
            [
             0.2222222222222222,
             "#7201a8"
            ],
            [
             0.3333333333333333,
             "#9c179e"
            ],
            [
             0.4444444444444444,
             "#bd3786"
            ],
            [
             0.5555555555555556,
             "#d8576b"
            ],
            [
             0.6666666666666666,
             "#ed7953"
            ],
            [
             0.7777777777777778,
             "#fb9f3a"
            ],
            [
             0.8888888888888888,
             "#fdca26"
            ],
            [
             1,
             "#f0f921"
            ]
           ],
           "sequentialminus": [
            [
             0,
             "#0d0887"
            ],
            [
             0.1111111111111111,
             "#46039f"
            ],
            [
             0.2222222222222222,
             "#7201a8"
            ],
            [
             0.3333333333333333,
             "#9c179e"
            ],
            [
             0.4444444444444444,
             "#bd3786"
            ],
            [
             0.5555555555555556,
             "#d8576b"
            ],
            [
             0.6666666666666666,
             "#ed7953"
            ],
            [
             0.7777777777777778,
             "#fb9f3a"
            ],
            [
             0.8888888888888888,
             "#fdca26"
            ],
            [
             1,
             "#f0f921"
            ]
           ]
          },
          "colorway": [
           "#636efa",
           "#EF553B",
           "#00cc96",
           "#ab63fa",
           "#FFA15A",
           "#19d3f3",
           "#FF6692",
           "#B6E880",
           "#FF97FF",
           "#FECB52"
          ],
          "font": {
           "color": "#2a3f5f"
          },
          "geo": {
           "bgcolor": "white",
           "lakecolor": "white",
           "landcolor": "#E5ECF6",
           "showlakes": true,
           "showland": true,
           "subunitcolor": "white"
          },
          "hoverlabel": {
           "align": "left"
          },
          "hovermode": "closest",
          "mapbox": {
           "style": "light"
          },
          "paper_bgcolor": "white",
          "plot_bgcolor": "#E5ECF6",
          "polar": {
           "angularaxis": {
            "gridcolor": "white",
            "linecolor": "white",
            "ticks": ""
           },
           "bgcolor": "#E5ECF6",
           "radialaxis": {
            "gridcolor": "white",
            "linecolor": "white",
            "ticks": ""
           }
          },
          "scene": {
           "xaxis": {
            "backgroundcolor": "#E5ECF6",
            "gridcolor": "white",
            "gridwidth": 2,
            "linecolor": "white",
            "showbackground": true,
            "ticks": "",
            "zerolinecolor": "white"
           },
           "yaxis": {
            "backgroundcolor": "#E5ECF6",
            "gridcolor": "white",
            "gridwidth": 2,
            "linecolor": "white",
            "showbackground": true,
            "ticks": "",
            "zerolinecolor": "white"
           },
           "zaxis": {
            "backgroundcolor": "#E5ECF6",
            "gridcolor": "white",
            "gridwidth": 2,
            "linecolor": "white",
            "showbackground": true,
            "ticks": "",
            "zerolinecolor": "white"
           }
          },
          "shapedefaults": {
           "line": {
            "color": "#2a3f5f"
           }
          },
          "ternary": {
           "aaxis": {
            "gridcolor": "white",
            "linecolor": "white",
            "ticks": ""
           },
           "baxis": {
            "gridcolor": "white",
            "linecolor": "white",
            "ticks": ""
           },
           "bgcolor": "#E5ECF6",
           "caxis": {
            "gridcolor": "white",
            "linecolor": "white",
            "ticks": ""
           }
          },
          "title": {
           "x": 0.05
          },
          "xaxis": {
           "automargin": true,
           "gridcolor": "white",
           "linecolor": "white",
           "ticks": "",
           "title": {
            "standoff": 15
           },
           "zerolinecolor": "white",
           "zerolinewidth": 2
          },
          "yaxis": {
           "automargin": true,
           "gridcolor": "white",
           "linecolor": "white",
           "ticks": "",
           "title": {
            "standoff": 15
           },
           "zerolinecolor": "white",
           "zerolinewidth": 2
          }
         }
        },
        "xaxis": {
         "anchor": "y",
         "domain": [
          0,
          1
         ],
         "title": {
          "text": "批判性思维能力"
         }
        },
        "yaxis": {
         "anchor": "x",
         "domain": [
          0,
          1
         ],
         "title": {
          "text": "对待AI作品的态度"
         }
        }
       }
      }
     },
     "metadata": {},
     "output_type": "display_data"
    }
   ],
   "source": [
    "fig = px.scatter(df,  # 数据集\n",
    "                 x=\"批判性思维能力\",  # x轴\n",
    "                 y=\"对待AI作品的态度\"  # y轴\n",
    "                )\n",
    "fig.show()"
   ]
  },
  {
   "attachments": {},
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "![](newplot1.png)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 20,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "积矩相关系数r为：0.029，决定系数r平方为：0.001，相关强度为极弱相关或不相关。 0.7244083050325453\n"
     ]
    }
   ],
   "source": [
    "x = '批判性思维能力'\n",
    "y = '对待AI作品的态度'\n",
    "r, p = stats.pearsonr(df[x], df[y])\n",
    "info = f\"积矩相关系数r为：{r:.3f}，决定系数r平方为：{r*r:.3f}，相关强度为{mytools.draw_on_r(r*r)}。\"\n",
    "print(info, p)\n"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "计算147名受试者的批判性思维能力和对待AI作品态度的得分，两个变量的Pearson相关系数$r(147)=0.029,p=0.724$，接受原假设，研究假设不成立，即两者不存在相关性。"
   ]
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 3.8.10 64-bit",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.8.10"
  },
  "orig_nbformat": 4,
  "vscode": {
   "interpreter": {
    "hash": "9650cb4e16cdd4a8e8e2d128bf38d875813998db22a3c986335f89e0cb4d7bb2"
   }
  }
 },
 "nbformat": 4,
 "nbformat_minor": 2
}
